-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add workflow that updates Argus(-frontend) version
This workflow will be triggered by a workflow in Argus or Argus-frontend that is triggered by a new release This workflow will create a PR with changes to the dockerfile that updates to the newest Argus(-frontend) version
- Loading branch information
1 parent
35159b3
commit 8f91370
Showing
1 changed file
with
51 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,51 @@ | ||
name: Change docker-compose.yml on release in Argus/Argus-frontend | ||
|
||
on: | ||
repository_dispatch: | ||
types: [trigger-release] | ||
|
||
jobs: | ||
change-dockerfile-on-release: | ||
runs-on: ubuntu-latest | ||
if: ${{ github.event.client_payload.repository }} == "Argus" || ${{ github.event.client_payload.repository }} == "Argus-frontend" | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Copy repository name & version into environment variables | ||
run: | | ||
repository="${{ github.event.client_payload.repository }}" | ||
version="${{ github.event.client_payload.version }}" | ||
# Remove 'v' from version (e.g. v1.14.0 -> 1.14.0) | ||
version="${version:1}" | ||
# Make repository name lowercase | ||
repository="${repository,}" | ||
echo "REPOSITORY=$repository" >> $GITHUB_ENV | ||
echo "VERSION=$version" >> $GITHUB_ENV | ||
- name: Create and switch to new branch | ||
run: | | ||
git switch -c update-${{ env.REPOSITORY }}-v${{ env.VERSION }} | ||
- name: Change version number in docker-compose.yml to newest | ||
run: | | ||
sed -i -e 's/${{ env.REPOSITORY }}:[0-9]\+.[0-9]\+.[0-9]\+/${{ env.REPOSITORY }}:${{ env.VERSION }}/' docker-compose.yml | ||
- name: Add, commit and push changes | ||
run: | | ||
git config user.email "[email protected]" | ||
git config user.name "Release update bot" | ||
git add "docker-compose.yml" | ||
git commit -m "Update ${{ env.REPOSITORY }} version to ${{ env.VERSION }}" | ||
git push -u origin update-${{ env.REPOSITORY }}-v${{ env.VERSION }} | ||
- name: Create pull request | ||
run: | | ||
gh pr create -B master -H update-${{ env.REPOSITORY }}-v${{ env.VERSION }} \ | ||
--title 'Update ${{ env.REPOSITORY }} version to ${{ env.VERSION }} in docker-compose.yml' \ | ||
--body 'Created by GitHub action, triggered by a release in ${{ env.REPOSITORY }} of version ${{ env.VERSION }}' | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |