From 1272e4009853e47df9fddeae08490dc17464d1da Mon Sep 17 00:00:00 2001 From: santiagosayshey Date: Thu, 20 Feb 2025 23:37:15 +1030 Subject: [PATCH] chore: add build workflows for beta/release (#144) - feat: add GitHub workflows for building Docker images for beta and release - fix: update notify workflow to trigger on version tags --- .../{docker-build.yml => beta-build.yml} | 8 +-- .github/workflows/notify.yml | 5 +- .github/workflows/release-build.yml | 53 +++++++++++++++++++ 3 files changed, 60 insertions(+), 6 deletions(-) rename .github/workflows/{docker-build.yml => beta-build.yml} (91%) create mode 100644 .github/workflows/release-build.yml diff --git a/.github/workflows/docker-build.yml b/.github/workflows/beta-build.yml similarity index 91% rename from .github/workflows/docker-build.yml rename to .github/workflows/beta-build.yml index c951dfb..71d2595 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/beta-build.yml @@ -1,13 +1,12 @@ -# .github/workflows/docker-build.yml -name: Build and Publish Docker Image +name: Build Beta Docker Image on: push: branches: - - v2-beta + - dev pull_request: branches: - - v2-beta + - dev jobs: build: @@ -38,6 +37,7 @@ jobs: uses: docker/setup-buildx-action@v3 - name: Login to Docker Hub + if: github.event_name != 'pull_request' uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} diff --git a/.github/workflows/notify.yml b/.github/workflows/notify.yml index 038a396..c4c5fc4 100644 --- a/.github/workflows/notify.yml +++ b/.github/workflows/notify.yml @@ -1,8 +1,9 @@ name: Notify on: push: - branches: - - 'v2-beta' + tags: + - 'v*' + jobs: notify: uses: Dictionarry-Hub/parrot/.github/workflows/notify.yml@main diff --git a/.github/workflows/release-build.yml b/.github/workflows/release-build.yml new file mode 100644 index 0000000..b5ee300 --- /dev/null +++ b/.github/workflows/release-build.yml @@ -0,0 +1,53 @@ +name: Build Release Docker Image + +on: + push: + tags: + - 'v*' + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Get tag + id: tag + run: echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: '18' + + - name: Build frontend + working-directory: ./frontend + run: | + npm ci + npm run build + + - name: Prepare dist directory + run: | + mkdir -p dist/backend dist/static + cp -r frontend/dist/* dist/static/ + cp -r backend/* dist/backend/ + cp backend/requirements.txt dist/ + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v5 + with: + context: . + push: true + tags: | + santiagosayshey/profilarr:latest + santiagosayshey/profilarr:${{ steps.tag.outputs.tag }}