Skip to content

Commit

Permalink
Trigger workflow in argus-docker on release
Browse files Browse the repository at this point in the history
The triggered workflow will take the sent repository name and version number to update its dockerfile
  • Loading branch information
johannaengland committed Aug 16, 2024
1 parent ef61bed commit 696d9e0
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/trigger-argus-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Trigger workflow in argus-docker on release

on:
release:
types: ["released"]

jobs:
trigger:
runs-on: ubuntu-latest
steps:
- name: Generate an installation access token
id: generate-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ vars.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
owner: ${{ github.repository_owner }}
repositories: "argus-docker"
- name: Trigger Workflow in argus-docker
env:
GH_TOKEN: ${{ steps.generate-token.outputs.token }}
run: |
repo_owner="Uninett"
repo_name="argus-docker"
event_type="trigger-release"
repository="${{ github.event.repository.name }}"
version="${{ github.event.release.tag_name }}"
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ env.GH_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/$repo_owner/$repo_name/dispatches \
-d "{\"event_type\": \"$event_type\", \
\"client_payload\": {\"repository\": \"$repository\", \"version\": \"$version\"}}"

0 comments on commit 696d9e0

Please sign in to comment.