diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 19c7f42f61..60f0d322de 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,6 +3,8 @@ name: CI on: push: pull_request: + release: + types: [ released ] jobs: prettier: @@ -77,7 +79,7 @@ jobs: github-token: ${{ secrets.GITHUB_TOKEN }} parallel-finished: true - docker-publish: + docker-publish-staging: if: (github.event_name == 'push' && github.ref == 'refs/heads/main') needs: [ prettier, es-lint, tests-finish ] runs-on: ubuntu-latest @@ -108,9 +110,43 @@ jobs: cache-from: type=registry,ref=${{ env.DOCKER_IMAGE_TAG }} cache-to: type=inline + docker-publish-release: + if: (github.event_name == 'release' && github.event.action == 'released') + needs: [ prettier, es-lint, tests-finish ] + runs-on: ubuntu-latest + env: + IMAGE_CACHE_SOURCE: staging + IMAGE_REGISTRY: safeglobal + IMAGE_NAME: safe-client-gateway-nest + steps: + - uses: actions/checkout@v3 + - run: | + BUILD_NUMBER=${{ github.sha }} + echo "BUILD_NUMBER=${BUILD_NUMBER::7}" >> "$GITHUB_ENV" + - uses: docker/setup-qemu-action@v2.2.0 + with: + platforms: arm64 + - uses: docker/setup-buildx-action@v2 + - uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_USER }} + password: ${{ secrets.DOCKER_PASSWORD }} + - uses: docker/build-push-action@v4 + with: + platforms: linux/amd64,linux/arm64 + push: true + build-args: | + BUILD_NUMBER=${{ env.BUILD_NUMBER }} + VERSION=${{ github.ref_name }} + tags: | + ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }} + ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_NAME }}:latest + cache-from: type=registry,ref=${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_CACHE_SOURCE }} + cache-to: type=inline + autodeploy: runs-on: ubuntu-latest - needs: [ docker-publish ] + needs: [ docker-publish-staging ] steps: - uses: actions/checkout@v3 - name: Deploy Staging