-
Notifications
You must be signed in to change notification settings - Fork 11
114 lines (103 loc) · 3.9 KB
/
create-release.yml
File metadata and controls
114 lines (103 loc) · 3.9 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
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*
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.0.0-rc.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.0.0-rc.1
if: ${{ (inputs.use-ckan && inputs.use-msbuild) || inputs.dependency-identifiers }}
# Install any listed CKAN dependencies
- uses: KSPModdingLibs/KSPBuildTools/.github/actions/install-dependencies@1.0.0-rc.1
if: ${{ inputs.dependency-identifiers }}
with:
dependency-identifiers: ${{ inputs.dependency-identifiers }}
- name: compile
if: ${{ inputs.use-msbuild }}
uses: KSPModdingLibs/KSPBuildTools/.github/actions/compile@1.0.0-rc.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.0.0-rc.1
with:
artifacts: ${{ inputs.artifacts }}
output-file-name: ${{ github.event.repository.name }}-${{ env.VERSION_STRING }}
- name: create-release
env:
GH_TOKEN: ${{ github.token }}
run: |
git push
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"