Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add workflow that updates Argus(-frontend) version in dockerfile #6

Merged
merged 1 commit into from
Sep 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions .github/workflows/update-dockerfile-on-release.yml
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 }}
Loading