Skip to content

Commit 65ee31b

Browse files
committed
Add a small workflow
1 parent 5cc761b commit 65ee31b

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# NOTE: This workflow is mainly used by an automated trigger that calls this when a gmod branch receives an update.
2+
name: Build Branch
3+
4+
on:
5+
workflow_dispatch:
6+
inputs:
7+
branch:
8+
description: 'Forces the specified branch to be updated.'
9+
required: false
10+
type: string
11+
default: "public"
12+
game_version:
13+
description: 'ID used for the Docker tag. Should be the time of the build'
14+
required: false
15+
type: string
16+
default: ""
17+
18+
jobs:
19+
trigger_build:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout Full Repo
23+
uses: actions/checkout@v4
24+
with:
25+
path: full_repo
26+
27+
- name: Get Latest Tag
28+
id: latest_tag
29+
run: |
30+
cd "$GITHUB_WORKSPACE/full_repo"
31+
# Robust tag matching for semver-like tags
32+
latest_tag=$(git tag --list --sort=-v:refname '[0-9]*.[0-9]*' '[0-9]*.[0-9]*.[0-9]*' | grep -v '[^0-9.]' | head -n 1)
33+
34+
if [ -z "$latest_tag" ]; then
35+
echo "Could not find a suitable latest tag."
36+
exit 1
37+
fi
38+
39+
echo "Latest tag: $latest_tag"
40+
echo "tag_name=$latest_tag" >> $GITHUB_OUTPUT
41+
42+
- name: Update ${{ inputs.branch }} Build
43+
uses: ./full_repo/.github/actions/build_and_push
44+
with:
45+
gmod_branch: ${{ inputs.branch }}
46+
game_version: ${{ inputs.game_version }}
47+
tag_name: ${{ steps.latest_tag.outputs.tag_name }}
48+
release: true
49+
github_token: ${{ secrets.GITHUB_TOKEN }}
50+
path: $GITHUB_WORKSPACE/full_repo
51+
52+
- name: Dispatch gmod_tests # Yes we shouldn't normally depend on this, though it really doesn't hurt.
53+
run: |
54+
curl -L \
55+
-X POST \
56+
-H "Accept: application/vnd.github+json" \
57+
-H "Authorization: Bearer ${{ secrets.GH_API_KEY }}" \
58+
-H "X-GitHub-Api-Version: 2022-11-28" \
59+
https://api.github.com/repos/CFC-Servers/gmod_tests/actions/workflows/single_branch_test.yml/dispatches \
60+
-d '{"ref":"main","inputs":{"branch":"${{ inputs.branch }}"}}'

0 commit comments

Comments
 (0)