-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Trigger workflow in argus-docker on release
The triggered workflow will take the sent repository name and version number to update its dockerfile
- Loading branch information
1 parent
ef61bed
commit 696d9e0
Showing
1 changed file
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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\"}}" |