Skip to content

Commit 5733a5f

Browse files
committed
add workshop updater actions
1 parent 3b43304 commit 5733a5f

1 file changed

Lines changed: 69 additions & 0 deletions

File tree

.github/workflows/version.yaml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: version handler
2+
3+
on:
4+
repository_dispatch:
5+
types: [build]
6+
7+
permissions:
8+
contents: write
9+
pull-requests: write
10+
11+
jobs:
12+
create-pr:
13+
name: update with PR
14+
runs-on: ubuntu-24.04
15+
steps:
16+
- name: checkout
17+
uses: actions/checkout@v5.0.0
18+
with:
19+
fetch-depth: 0
20+
21+
- name: check branch exists
22+
id: check
23+
env:
24+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25+
run: |
26+
prs=$(gh pr list \
27+
--repo "$GITHUB_REPOSITORY" \
28+
--head 'version-updates' \
29+
--base 'main' \
30+
--json title \
31+
--jq 'length')
32+
if ((prs > 0)); then
33+
echo "exists=true" >> "$GITHUB_OUTPUT"
34+
fi
35+
36+
- name: checkout branch
37+
if: 'steps.check.outputs.exists'
38+
run: |
39+
git config --global user.name 'jimboid'
40+
git config --global user.email 'jimboid@users.noreply.github.com'
41+
git checkout version-updates
42+
43+
- name: update version in json
44+
run: |
45+
jq --arg a "${{ github.event.client_payload.tag }}" '.containers."${{ github.event.client_payload.repo }}".latest = ($a)' workshop.json | jq "." | cat > workshop2.json; mv workshop2.json workshop.json
46+
47+
- name: display
48+
run: |
49+
cat workshop.json
50+
51+
- name: push changes
52+
if: 'steps.check.outputs.exists'
53+
run: |
54+
git commit -am "update ${{ github.event.client_payload.repo }} version to ${{ github.event.client_payload.tag }}"
55+
git push
56+
57+
- name: send PR
58+
if: '!steps.check.outputs.exists'
59+
uses: peter-evans/create-pull-request@v7.0.8
60+
with:
61+
commit-message: Update ${{ github.event.client_payload.repo }} version to ${{ github.event.client_payload.tag }}
62+
branch: version-updates
63+
title: "Update to workshop.json"
64+
body: |
65+
Update ${{ github.event.client_payload.repo }} version to ${{ github.event.client_payload.tag }}
66+
base: main
67+
assignees: jimboid
68+
signoff: false
69+
draft: false

0 commit comments

Comments
 (0)