Skip to content

Commit 28a7eb0

Browse files
committed
Pin KSPBT actions within reusable workflows
From now on, release with `just release {{args}}` with the usual yaclog version args like `--patch` or `--minor`. It will automatically run `yaclog release` alongside updating all reusable workflows to have the correct tags. Pinning workflows to a branch (or leaving them unpinned) should be avoided from here on, only pin to tags. The pin updating can be done on its own with `just pin-workflows {{ref}}` Makes #67 unnecessary commit 82828e9 Author: Andrew Cassidy <[email protected]> Date: Tue Oct 28 17:49:32 2025 -0700 Add note to the docs commit f70929c Author: Andrew Cassidy <[email protected]> Date: Tue Oct 28 17:41:19 2025 -0700 Only run checks for tag events commit 108d8b8 Author: Andrew Cassidy <[email protected]> Date: Tue Oct 28 17:39:05 2025 -0700 Check for mismatches this CI run should fail, I'll later restrict this check to only on tag pushes commit bf2a436 Author: Andrew Cassidy <[email protected]> Date: Tue Oct 28 17:37:59 2025 -0700 Fix regex commit adb4c77 Author: Andrew Cassidy <[email protected]> Date: Tue Oct 28 17:35:22 2025 -0700 Fix line endings commit 0c99c7f Author: Andrew Cassidy <[email protected]> Date: Tue Oct 28 17:21:15 2025 -0700 run yaclog via uv this allows us to pin the version commit 814ba63 Author: Andrew Cassidy <[email protected]> Date: Tue Oct 28 17:14:56 2025 -0700 Add tool to pin workflows while releasing a new version (cherry picked from commit 09427ed)
1 parent c722523 commit 28a7eb0

File tree

7 files changed

+79
-48
lines changed

7 files changed

+79
-48
lines changed

.github/workflows/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.backup

.github/workflows/create-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ jobs:
6464
submodules: true
6565

6666
- name: update-version
67-
uses: KSPModdingLibs/KSPBuildTools/.github/actions/update-version@main
67+
uses: KSPModdingLibs/KSPBuildTools/.github/actions/update-version@0.0.4
6868
with:
6969
version-string: ${{ inputs.version-string }}
7070
template-extension: ${{ inputs.version-template-extension }}

.github/workflows/internal-ci.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ jobs:
2727
with:
2828
fetch-depth: 0 # get full history, not shallow clone
2929

30+
- name: Check for workflows with outdated action pins
31+
if: startsWith(github.ref, 'refs/tags')
32+
run: |
33+
! grep -P -i 'uses: KSPModdingLibs/KSPBuildTools/\.github/actions/.*@(?!${{ github.ref_name }}$)' .github/workflows/*.yml
34+
3035
- name: Setup .NET
3136
uses: actions/setup-dotnet@v4
3237
with:
Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,47 @@
1-
name: publish-to-spacedock
2-
3-
on:
4-
workflow_call:
5-
inputs:
6-
spacedock-username:
7-
type: string
8-
required: true
9-
description: Spacedock login username
10-
mod-id:
11-
type: string
12-
required: true
13-
description: ID of the mod we are deploying. Get this from the end of your mod's spacedock URL
14-
release-tag:
15-
type: string
16-
required: false
17-
description: The tag of the release. Will be the same as `inputs.release-tag` unless it was blank.
18-
game-id:
19-
type: string
20-
required: false
21-
default: '3102' # hardcoded to KSP1 gameid. retrieve from https://spacedock.info/api/games
22-
description: ID of the game we are deploying for. This should probably be left as-is for KSP 1.
23-
secrets:
24-
spacedock-password:
25-
required: true
26-
description: Spacedock login password. Store this as a secret!
27-
28-
jobs:
29-
publish-to-spacedock:
30-
runs-on: ubuntu-22.04
31-
steps:
32-
- name: get-release-info
33-
id: get-release-info
34-
uses: KSPModdingLibs/KSPBuildTools/.github/actions/[email protected]
35-
with:
36-
release-tag: ${{ inputs.release-tag }}
37-
38-
- name: upload-to-spacedock
39-
uses: KSP2Community/[email protected]
40-
with:
41-
username: ${{ inputs.spacedock-username }}
42-
password: ${{ secrets.spacedock-password }}
43-
game_id: ${{ inputs.game-id }}
44-
mod_id: ${{ inputs.mod-id }}
45-
version: ${{ steps.get-release-info.outputs.version-string }}
46-
zipball: ${{ steps.get-release-info.outputs.artifact-file }}
47-
changelog: ${{ steps.get-release-info.outputs.changelog-file }}
1+
name: publish-to-spacedock
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
spacedock-username:
7+
type: string
8+
required: true
9+
description: Spacedock login username
10+
mod-id:
11+
type: string
12+
required: true
13+
description: ID of the mod we are deploying. Get this from the end of your mod's spacedock URL
14+
release-tag:
15+
type: string
16+
required: false
17+
description: The tag of the release. Will be the same as `inputs.release-tag` unless it was blank.
18+
game-id:
19+
type: string
20+
required: false
21+
default: '3102' # hardcoded to KSP1 gameid. retrieve from https://spacedock.info/api/games
22+
description: ID of the game we are deploying for. This should probably be left as-is for KSP 1.
23+
secrets:
24+
spacedock-password:
25+
required: true
26+
description: Spacedock login password. Store this as a secret!
27+
28+
jobs:
29+
publish-to-spacedock:
30+
runs-on: ubuntu-22.04
31+
steps:
32+
- name: get-release-info
33+
id: get-release-info
34+
uses: KSPModdingLibs/KSPBuildTools/.github/actions/[email protected]
35+
with:
36+
release-tag: ${{ inputs.release-tag }}
37+
38+
- name: upload-to-spacedock
39+
uses: KSP2Community/[email protected]
40+
with:
41+
username: ${{ inputs.spacedock-username }}
42+
password: ${{ secrets.spacedock-password }}
43+
game_id: ${{ inputs.game-id }}
44+
mod_id: ${{ inputs.mod-id }}
45+
version: ${{ steps.get-release-info.outputs.version-string }}
46+
zipball: ${{ steps.get-release-info.outputs.artifact-file }}
47+
changelog: ${{ steps.get-release-info.outputs.changelog-file }}

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,9 @@ obj
55

66
# docs
77
docs/_build
8+
9+
# misc
10+
.DS_Store
11+
.idea
12+
*.user
13+
*.backup

docs/workflows/index.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ KSPBuildTools provides several reusable workflows for use with Github Actions. T
44

55
For usage, see [Reusing Workflows](https://docs.github.com/en/actions/sharing-automations/reusing-workflows) in the Github docs.
66

7+
```{warning}
8+
Due to a limitation of Github actions, only *tagged releases* have reusable workflows with the correct action version. If you pin a workflow to a branch, or leave your workflow usage unpinned, it may run action versions incompatible with the workflow
9+
```
10+
711
```{toctree}
812
---
913
caption: Contents

justfile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
set shell:= ['bash', '-c']
2+
yaclog:= "uv tool run [email protected]"
3+
4+
pin-workflows tag:
5+
sed -E -H -i ".backup" "s|(uses: KSPModdingLibs/KSPBuildTools/\.github/actions/\S+@)\S+|\1{{tag}}|g" .github/workflows/*.yml
6+
7+
release *args:
8+
{{yaclog}} release {{args}}
9+
@just pin-workflows $({{yaclog}} show --version)
10+
git add .github/workflows/*.yml
11+
{{yaclog}} release -c
12+
13+
docs:
14+
uv run --with-requirements docs/requirements.txt --no-project -m sphinx docs/ docs/_build
15+

0 commit comments

Comments
 (0)