From e612cf9936c4d8bce3a71cc57f8562dcf72d9743 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Thu, 23 Jan 2025 22:24:35 +0100 Subject: [PATCH] Move docker build into the same workflow --- .gitea/workflows/build.yml | 46 -------------------------------------- .gitea/workflows/tests.yml | 42 +++++++++++++++++++++++++++++++++- 2 files changed, 41 insertions(+), 47 deletions(-) delete mode 100644 .gitea/workflows/build.yml diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml deleted file mode 100644 index 5748059..0000000 --- a/.gitea/workflows/build.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: Build Nginx-based docker image -on: - push: - branches: - - main - pull_request: -concurrency: - group: ${{ github.ref }} - cancel-in-progress: true -jobs: - build-static-assets: - runs-on: ubuntu-latest - timeout-minutes: 30 - steps: - - uses: actions/checkout@v4 - with: - token: ${{ secrets.GITHUB_TOKEN }} - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Login to the private Docker registry - uses: docker/login-action@v3 - with: - registry: ${{ secrets.PRIVATE_REGISTRY_HOST }} - username: ${{ secrets.PRIVATE_REGISTRY_USERNAME }} - password: ${{ secrets.PRIVATE_REGISTRY_TOKEN }} - - - name: Build and push intermediate stages (build) - uses: docker/build-push-action@v6 - with: - context: . - target: build - push: ${{ github.ref == 'refs/heads/main' }} - tags: ${{ secrets.PRIVATE_REGISTRY_HOST }}/${{ env.GITHUB_REPOSITORY }}:build - cache-from: type=registry,ref=${{ secrets.PRIVATE_REGISTRY_HOST }}/${{ env.GITHUB_REPOSITORY }}:build - cache-to: type=inline - - - name: Build and push (final) - uses: docker/build-push-action@v6 - with: - context: . - push: ${{ github.ref == 'refs/heads/main' }} - tags: ${{ secrets.PRIVATE_REGISTRY_HOST }}/${{ env.GITHUB_REPOSITORY }}:latest - cache-from: type=registry,ref=${{ secrets.PRIVATE_REGISTRY_HOST }}/${{ env.GITHUB_REPOSITORY }}:latest - cache-to: type=inline \ No newline at end of file diff --git a/.gitea/workflows/tests.yml b/.gitea/workflows/tests.yml index 7be8b5d..cdf1022 100644 --- a/.gitea/workflows/tests.yml +++ b/.gitea/workflows/tests.yml @@ -62,4 +62,44 @@ jobs: - run: bundle install - *postgres_wait - run: bundle exec rake db:schema:load - - run: bundle exec rake db:migrate:redo \ No newline at end of file + - run: bundle exec rake db:migrate:redo + build-static-assets: + runs-on: ubuntu-latest + timeout-minutes: 30 + needs: + - unit_tests + - rubocop + - reversible_migrations + steps: + - uses: actions/checkout@v4 + with: + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to the private Docker registry + uses: docker/login-action@v3 + with: + registry: ${{ secrets.PRIVATE_REGISTRY_HOST }} + username: ${{ secrets.PRIVATE_REGISTRY_USERNAME }} + password: ${{ secrets.PRIVATE_REGISTRY_TOKEN }} + + - name: Build and push intermediate stages (build) + uses: docker/build-push-action@v6 + with: + context: . + target: build + push: ${{ github.ref == 'refs/heads/main' }} + tags: ${{ secrets.PRIVATE_REGISTRY_HOST }}/${{ env.GITHUB_REPOSITORY }}:build + cache-from: type=registry,ref=${{ secrets.PRIVATE_REGISTRY_HOST }}/${{ env.GITHUB_REPOSITORY }}:build + cache-to: type=inline + + - name: Build and push (final) + uses: docker/build-push-action@v6 + with: + context: . + push: ${{ github.ref == 'refs/heads/main' }} + tags: ${{ secrets.PRIVATE_REGISTRY_HOST }}/${{ env.GITHUB_REPOSITORY }}:latest + cache-from: type=registry,ref=${{ secrets.PRIVATE_REGISTRY_HOST }}/${{ env.GITHUB_REPOSITORY }}:latest + cache-to: type=inline \ No newline at end of file