Skip to content

Commit 4672674

Browse files
committed
Change assemble-release to no longer upload anything
as well as changing its outputs
1 parent d6d7edc commit 4672674

File tree

8 files changed

+58
-40
lines changed

8 files changed

+58
-40
lines changed

.github/actions/assemble-release/action.yml

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Assemble Release
22

33
x-env:
44
RELEASE_STAGING:
5-
description: The artifact files will be copied to this directory before being packaged in the zip file. This becomes the input for `upload-artifact`. If not set, `/tmp/release` is used instead
5+
description: The artifact files will be copied to this directory before being packaged in the zip file. If not set, `/tmp/release` is used instead
66

77
inputs:
88
artifacts:
@@ -30,17 +30,21 @@ outputs:
3030
value: ${{ steps.upload-artifact.outputs.artifact-url }}
3131
description: Artifact URL from the upload-artifact action
3232

33-
artifact-path:
34-
value: ${{ steps.assemble-release.outputs.artifact-path }}
35-
description: Local path to the produced zip file
33+
artifact-zip-path:
34+
value: ${{ steps.assemble-release.outputs.artifact-zip-path }}
35+
description: Local path to the produced release zip file
36+
37+
artifact-dir-path:
38+
value: ${{ steps.assemble-release.outputs.artifact-dir-path }}
39+
description: Local path to the produced release directory
3640

3741
runs:
3842
using: composite
3943
steps:
4044
- name: Set RELEASE_STAGING
4145
if: ${{ !env.RELEASE_STAGING}}
4246
shell: bash
43-
run: echo 'RELEASE_STAGING=${{ '/tmp/release' }}' >> "$GITHUB_ENV"
47+
run: echo 'RELEASE_STAGING=/tmp/release/' >> "$GITHUB_ENV"
4448

4549
- name: Copy Files to Staging
4650
shell: bash
@@ -49,25 +53,16 @@ runs:
4953
shopt -s nocaseglob # so globs are case-insensitive
5054
shopt -s globstar
5155
shopt -s nullglob
52-
mkdir -p ${{ env.RELEASE_STAGING }}
53-
cp -r -v ${{ inputs.artifacts }} ${{ env.RELEASE_STAGING }}
54-
cd ${{ env.RELEASE_STAGING }}
56+
mkdir -p ${{ env.RELEASE_STAGING }}/${{ inputs.output-file-name}}
57+
cp -r -v ${{ inputs.artifacts }} ${{ env.RELEASE_STAGING }}/${{ inputs.output-file-name}}
58+
cd ${{ env.RELEASE_STAGING }}/${{ inputs.output-file-name}}
5559
rm -f ${{ inputs.artifacts-exclude }}
5660
5761
- name: Assemble Release
5862
id: assemble-release
5963
shell: bash
6064
working-directory: ${{ env.RELEASE_STAGING }}
6165
run: |
62-
zip -r ${{ github.workspace }}/${{ inputs.output-file-name }}.zip .
63-
echo 'ARTIFACT_FILENAME=${{ inputs.output-file-name }}' >> $GITHUB_ENV
64-
echo 'artifact-path=${{ github.workspace }}/${{ inputs.output-file-name }}.zip' >> $GITHUB_OUTPUT
65-
66-
- name: Upload Artifact
67-
id: upload-artifact
68-
uses: actions/upload-artifact@v4
69-
with:
70-
path: ${{ env.RELEASE_STAGING }}
71-
name: ${{ inputs.output-file-name }}
72-
if-no-files-found: error
73-
include-hidden-files: 'true' # behavior changed in 4.4.0. Include hidden for matching the behavior of `zip`
66+
zip -r ${{ inputs.output-file-name }}.zip ${{ inputs.output-file-name}}
67+
echo 'artifact-zip-path=${{ env.RELEASE_STAGING }}/${{ inputs.output-file-name }}.zip' >> $GITHUB_OUTPUT
68+
echo 'artifact-dir-path=${{ env.RELEASE_STAGING }}/${{ inputs.output-file-name}}' >> $GITHUB_OUTPUT

.github/workflows/build.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,18 @@ jobs:
7979
solution-file-path: ${{ inputs.solution-file-path }}
8080
use-nuget-restore: ${{ inputs.use-nuget-restore }}
8181

82-
# Assemble the mod into a release package and upload it as an artifact
82+
# Assemble the mod into a release package
8383
- uses: KSPModdingLibs/KSPBuildTools/.github/actions/[email protected]
84+
id: assemble-release
8485
with:
8586
artifacts: ${{ inputs.artifacts }}
86-
output-file-name: ${{ github.event.repository.name }}-${{ inputs.build-configuration }}
87+
output-file-name: ${{ github.event.repository.name }}
88+
89+
# Upload artifact
90+
- uses: actions/upload-artifact@v4
91+
id: upload-artifact
92+
with:
93+
path: ${{ steps.assemble-release.outputs.artifact-dir-path }}
94+
name: ${{ github.event.repository.name }}-${{ inputs.build-configuration }}
95+
if-no-files-found: error
96+
include-hidden-files: 'true' # behavior changed in 4.4.0. Include hidden for matching the behavior of `zip`

.github/workflows/create-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,4 +111,4 @@ jobs:
111111
GH_TOKEN: ${{ github.token }}
112112
run: |
113113
git push
114-
gh release create "$VERSION_STRING" --draft --target ${{ github.ref_name }} --title "$VERSION_STRING" "$ARTIFACT_FILENAME.zip" --notes-file "$RELEASE_NOTES_FILE"
114+
gh release create "$VERSION_STRING" --draft --target ${{ github.ref_name }} --title "$VERSION_STRING" "${{ steps.assemble-release.outputs.artifact-zip-path }}" --notes-file "$RELEASE_NOTES_FILE"

.github/workflows/internal-test-plugin-legacy.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,14 @@ jobs:
2727
use-nuget-restore: true
2828

2929
- uses: ./.github/actions/assemble-release
30+
id: assemble-release
3031
with:
3132
artifacts: ${{ env.TESTDIR }}/GameData
3233
output-file-name: plugin-mod-legacy
34+
35+
- uses: actions/upload-artifact@v4
36+
with:
37+
path: ${{ steps.assemble-release.outputs.artifact-dir-path }}
38+
name: plugin-mod-legacy
39+
if-no-files-found: error
40+
include-hidden-files: 'true' # behavior changed in 4.4.0. Include hidden for matching the behavior of `zip`

.github/workflows/internal-test-plugin-nuget.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,14 @@ jobs:
4848
KSPBuildToolsVersion: ${{ inputs.package-version }}
4949

5050
- uses: ./.github/actions/assemble-release
51+
id: assemble-release
5152
with:
5253
artifacts: ${{ env.TESTDIR }}/GameData
53-
output-file-name: plugin-mod-nuget-${{ matrix.dotnet-version }}
54+
output-file-name: plugin-mod-nuget
55+
56+
- uses: actions/upload-artifact@v4
57+
with:
58+
path: ${{ steps.assemble-release.outputs.artifact-dir-path }}
59+
name: plugin-mod-nuget-${{ matrix.dotnet-version }}
60+
if-no-files-found: error
61+
include-hidden-files: 'true' # behavior changed in 4.4.0. Include hidden for matching the behavior of `zip`

.github/workflows/internal-test-plugin.yml

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,9 @@ jobs:
3232
working-directory: ${{ env.TESTDIR }}
3333
output-file-name: plugin-mod
3434

35-
- name: Get github artifact
36-
uses: actions/download-artifact@v4
35+
- uses: actions/upload-artifact@v4
3736
with:
37+
path: ${{ steps.assemble-release.outputs.artifact-dir-path }}
3838
name: plugin-mod
39-
path: github-artifact
40-
41-
- name: Compare with zip artifact
42-
run: |
43-
unzip ${{ steps.assemble-release.outputs.artifact-path }} -d zip-artifact
44-
45-
tree github-artifact
46-
tree zip-artifact
47-
48-
if [[ $(tree github-artifact/* | sed '1d') != $(tree zip-artifact/* | sed '1d') ]]; then echo "tree mismatch" && false; fi # fail if contents differ
49-
if [[ ! -d github-artifact/GameData ]]; then echo "GameData not present" && false; fi # fail if GameData folder isnt present
50-
if [[ -f github-artifact/GameData/plugin-mod/PluginMod.pdb ]]; then echo "pdb still present" && false; fi # fail if PDB is still present
39+
if-no-files-found: error
40+
include-hidden-files: 'true' # behavior changed in 4.4.0. Include hidden for matching the behavior of `zip`

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ All notable changes to this project will be documented in this file
2929
- `compile` action: Removed call to`actions/setup-dotnet`. Setting up .NET should be done as a separate step. (#65)
3030
- `setup-ckan` action: Sped up execution by skipping recommended packages and man-db updates
3131
- `setup-ckan` action: Add `ckan-install-method` option for installation method. Currently supports `'apt'` for installation on Debian/Ubuntu, or `'skip'` to skip installation for runners that already have CKAN installed.
32-
- `assemble-release` action: `outputs.artifact-path` now includes the `.zip` extension (#51)
32+
- `assemble-release` action: `outputs.artifact-path` was split into `outputs.artifact-zip-path` and `outputs.artifact-dir-path` containing paths to a zip file and directory respectively. These are also now located under `$RELEASE_STAGING` instead of inside the workspace
33+
- `assemble-release` action: Removed call to `actions/upload-artifact`. This should be done as a separate step.
3334

3435
### Library
3536

docs/migration.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ would become
3939

4040
## CI Actions
4141

42-
### {gha:action}`compile`
42+
### {gha:action}`compile`:
4343

4444
The compile action no longer runs `setup-dotnet`. You need to run this step separately.
4545

@@ -53,6 +53,12 @@ If your mod uses a `packages.config` file, you need to specify `use-nuget-restor
5353
5454
If your mod *does not* use a `packages.config` file, you can migrate your workflows on Github runners to use Ubuntu 24.04 or later.
5555

56+
### {gha:action}`assemble-release`:
57+
58+
The assemble release action no longer runs `upload-artifact`. You need to run this step separately.
59+
60+
Additionally, the `artifact-path` output was split into `artifact-zip-path` and `artifact-dir-path` containing paths to a zip file and directory respectively. Use the correct one depending on if you want a directory or a zip.
61+
5662
## Library
5763

5864
If you made use of the logging utilities under the `KSPBuildTools` namespace, you should migrate to [KSPCommunityLib](https://git.offworldcolonies.nexus/KSPModdingLibs/KSPCommunityLib) instead.

0 commit comments

Comments
 (0)