Skip to content

Commit

Permalink
Build on staging too, on develop, and push through GitOps. Notify t…
Browse files Browse the repository at this point in the history
…here instead

of via Slack direct.
  • Loading branch information
Alexandre Bourget committed Sep 20, 2024
1 parent c656443 commit b6e6803
Showing 1 changed file with 17 additions and 14 deletions.
31 changes: 17 additions & 14 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
- develop
- feature/*
- codegen-cmd
- staging

env:
REGISTRY: ghcr.io
Expand All @@ -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

Expand All @@ -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/') }}
Expand All @@ -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/[email protected]
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 }}

0 comments on commit b6e6803

Please sign in to comment.