forked from KSPModdingLibs/KSPBuildTools
-
Notifications
You must be signed in to change notification settings - Fork 0
133 lines (122 loc) · 4.71 KB
/
create-release.yml
File metadata and controls
133 lines (122 loc) · 4.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
name: create-release
on:
workflow_call:
inputs:
version-string:
type: string
required: true
# TODO: pull this from a tag? Or should this workflow create a new tag?
version-template-extension:
type: string
default: .versiontemplate
version-template-files:
type: string
build-configuration:
type: string
default: Release
artifacts:
type: string
default: GameData LICENSE* README* CHANGELOG*
flatten:
type: boolean
default: true
description: >
If true, the release zip is built with the artifact files at the root
instead of nested under a top-level directory. Forwarded to the
assemble-release action.
version-file:
type: string
description: >
Path to a KSP-AVC `.version` file (relative to the repository root).
If set, the file is attached to the github release as a separate
asset alongside the assembled zip, so tools like CKAN's NetKAN can
read it without downloading the full archive.
ksp-zip-url:
type: string
default: https://github.com/KSPModdingLibs/KSPLibs/raw/main/KSP-1.12.5.zip
dependency-identifiers:
type: string
solution-file-path:
type: string
use-msbuild:
type: boolean
default: true
description: >
If MSBuild should be used. If your mod has no msbuild project (e.g. a pure part mod)
you should set this to false
use-ckan:
type: boolean
default: false
description: >
If CKAN should be installed to install dependencies in the msbuild project.
changelog-input-file:
type: string
default: CHANGELOG.md
changelog-output-file:
type: string
secrets:
ksp-zip-password:
required: false
env:
KSP_ROOT: /tmp/ksp
RELEASE_STAGING: /tmp/release
VERSION_STRING: ${{ inputs.version-string }} #note this may be modified by update-version if it is one of the special tokens
defaults:
run:
shell: bash
jobs:
build:
runs-on: ubuntu-22.04
steps:
- name: Checkout Mod Repo
uses: actions/checkout@v4
with:
submodules: true
- name: update-version
uses: KSPModdingLibs/KSPBuildTools/.github/actions/update-version@1.1.1
with:
version-string: ${{ inputs.version-string }}
template-extension: ${{ inputs.version-template-extension }}
files: ${{ inputs.version-template-files }}
changelog-input-file: ${{ inputs.changelog-input-file }}
changelog-output-file: ${{ inputs.changelog-output-file }}
- name: commit-version-and-tag
working-directory: ${{ github.workspace }}
run: |
git config --global user.name "github-actions"
git config --global user.email "github-actions@github.com"
git commit --allow-empty -m "bump version to $VERSION_STRING"
git tag -f -a "$VERSION_STRING" -m "$VERSION_STRING"
# Install CKAN and set up an instance
- uses: KSPModdingLibs/KSPBuildTools/.github/actions/setup-ckan@1.1.1
if: ${{ (inputs.use-ckan && inputs.use-msbuild) || inputs.dependency-identifiers }}
# Install any listed CKAN dependencies
- uses: KSPModdingLibs/KSPBuildTools/.github/actions/install-dependencies@1.1.1
if: ${{ inputs.dependency-identifiers }}
with:
dependency-identifiers: ${{ inputs.dependency-identifiers }}
- name: compile
if: ${{ inputs.use-msbuild }}
uses: KSPModdingLibs/KSPBuildTools/.github/actions/compile@1.1.1
with:
build-configuration: ${{ inputs.build-configuration }}
ksp-zip-url: ${{ inputs.ksp-zip-url }}
ksp-zip-password: ${{ secrets.ksp-zip-password }}
solution-file-path: ${{ inputs.solution-file-path }}
- name: assemble-release
id: assemble-release
uses: KSPModdingLibs/KSPBuildTools/.github/actions/assemble-release@1.1.1
with:
artifacts: ${{ inputs.artifacts }}
output-file-name: ${{ github.event.repository.name }}-${{ env.VERSION_STRING }}
flatten: ${{ inputs.flatten }}
- name: create-release
env:
GH_TOKEN: ${{ github.token }}
ARTIFACT_ZIP: ${{ steps.assemble-release.outputs.artifact-zip-path }}
VERSION_FILE: ${{ inputs.version-file }}
run: |
git push
assets=("$ARTIFACT_ZIP")
[ -n "$VERSION_FILE" ] && assets+=("$VERSION_FILE")
gh release create "$VERSION_STRING" --draft --target ${{ github.ref_name }} --title "$VERSION_STRING" --notes-file "$RELEASE_NOTES_FILE" "${assets[@]}"