From b6e6803e60591a583cdf806c9c6b30edb2bb8af1 Mon Sep 17 00:00:00 2001 From: Alexandre Bourget Date: Fri, 20 Sep 2024 00:50:42 -0400 Subject: [PATCH] Build on staging too, on `develop`, and push through GitOps. Notify there instead of via Slack direct. --- .github/workflows/docker.yml | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index ff7e8b9..edeb0be 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -8,6 +8,7 @@ on: - develop - feature/* - codegen-cmd + - staging env: REGISTRY: ghcr.io @@ -25,6 +26,11 @@ jobs: tags: ${{ steps.meta.outputs.tags }} steps: + - name: "Deploy: GitOps running" + run: | + curl https://argocd.streamingfast.io/updater/running --oauth2-bearer ${{ secrets.GITOPS_TOKEN }} \ + -d repo=${{ github.repository }} -d run_id=${{ github.run_id }} -d author=${{ github.actor }} -d "ref=${{ github.ref }}" + - name: Checkout repository uses: actions/checkout@v3 @@ -42,7 +48,7 @@ jobs: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} tags: | type=ref,event=tag - type=sha,prefix=,enable=true + type=sha type=raw,enable=${{ github.ref == 'refs/heads/develop' }},value=develop flavor: | latest=${{ startsWith(github.ref, 'refs/tags/') }} @@ -55,16 +61,13 @@ jobs: tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} - slack-notifications: - if: ${{ !startsWith(github.ref, 'refs/tags/') && github.event_name != 'workflow_dispatch' }} - - needs: [ build ] - runs-on: ubuntu-20.04 - steps: - - name: Slack notification - env: - SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} - uses: Ilshidur/action-slack@2.0.2 - with: - args: | - :done: *${{ github.repository }}* Success building docker image from ${{ github.ref_type }} _${{ github.ref_name }}_ (${{ github.actor }}) :sparkling_heart: ```${{ join(needs.build.outputs.tags, ' ') }}``` + - name: "Deploy: trigger GitOps" + run: | + curl https://argocd.streamingfast.io/updater/success --oauth2-bearer ${{ secrets.GITOPS_TOKEN }} \ + -d repo=${{ github.repository }} -d run_id=${{ github.run_id }} -d "ref=${{ github.ref }}" \ + -d "author=${{ github.actor }}" -d "images=${{ steps.meta.outputs.tags }}" + - name: "Deploy: GitOps failed" + if: ${{ failure() }} + run: | + curl https://argocd.streamingfast.io/updater/failed --oauth2-bearer ${{ secrets.GITOPS_TOKEN }} \ + -d repo=${{ github.repository }} -d run_id=${{ github.run_id }}