-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat/workflow for docker compose image tags (#2319)
- Loading branch information
1 parent
928ee3c
commit 5c4d32e
Showing
1 changed file
with
43 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,43 @@ | ||
name: Update docker-compose.yaml tags | ||
|
||
on: | ||
schedule: | ||
- cron: '0 15 * * 1' | ||
workflow_dispatch: | ||
inputs: {} | ||
permissions: | ||
issues: write | ||
pull-requests: write | ||
contents: write | ||
|
||
|
||
env: | ||
PR_BRANCH: automated/docker-compose-image-tags-upgrade | ||
PR_LABEL: dependencies | ||
PR_TITLE: "feat: upgrade `docker-compose.yml` stable image tags" | ||
|
||
jobs: | ||
update-docker-compose-tag: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: create-PR | ||
shell: bash | ||
run: | | ||
set -eou pipefail | ||
latest_tag="$(gh api \ | ||
-H "Accept: application/vnd.github+json" \ | ||
-H "X-GitHub-Api-Version: 2022-11-28" \ | ||
/repos/${{ github.repository }}/releases/latest | jq '.tag_name')" | ||
sed -i -E 's|(image: ghcr\.io/peerdb\-io/.*?:stable-)(.*$)|\1'"${latest_tag}"'|g' docker-compose.yml | ||
git checkout -b "${PR_BRANCH}" | ||
git fetch || true | ||
git push -u origin "${PR_BRANCH}" --force-with-lease | ||
PR_ID=$(gh pr list "${PR_LABEL}" --head "${PR_BRANCH}" --json number | jq -r '.[0].number // ""') | ||
if [ "$PR_ID" == "" ]; then | ||
PR_ID=$(gh pr create -l "$PR_LABEL" -t "$PR_TITLE" --body "") | ||
fi | ||
git commit -m 'chore(automated): upgrade docker-compose.yml stable tags' | ||
gh pr merge --auto --squash |