forked from LostArtefacts/TRX
-
Notifications
You must be signed in to change notification settings - Fork 0
89 lines (79 loc) · 2.78 KB
/
job_release.yml
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
name: Create a new release
on:
workflow_call:
inputs:
changelog_game_version:
type: string
description: "Game version to build the changelog from"
required: true
draft:
type: boolean
description: "Draft"
required: true
default: false
prerelease:
type: boolean
description: "Prerelease"
required: true
default: false
tag_name:
type: string
description: "Tag name"
required: false
default: github.ref_name
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: "Install dependencies"
uses: taiki-e/install-action@just
- name: "Checkout code"
uses: actions/checkout@v4
with:
submodules: 'true'
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- name: "Prepare release data"
id: prepare_release_data
run: |
echo -n "release_name=" >> $GITHUB_OUTPUT
just output-release-name ${{ inputs.changelog_game_version }} >> $GITHUB_OUTPUT
echo "changelog<<EOF" >> $GITHUB_OUTPUT
just output-current-changelog ${{ inputs.changelog_game_version }} >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: "Download built game assets"
uses: actions/download-artifact@v4
with:
path: artifacts/
merge-multiple: true
- name: "Get information on the latest pre-release"
if: ${{ inputs.prerelease == true || inputs.prerelease == 'true' }}
id: last_release
uses: InsonusK/get-latest-release@v1.0.1
with:
myToken: ${{ github.token }}
exclude_types: "draft|release"
- name: 'Mark the pre-release as latest'
if: ${{ inputs.prerelease == true || inputs.prerelease == 'true' }}
uses: EndBug/latest-tag@latest
- name: "Delete old pre-release assets"
if: ${{ inputs.prerelease == true || inputs.prerelease == 'true' }}
uses: mknejp/delete-release-assets@v1
continue-on-error: true
with:
token: ${{ github.token }}
tag: ${{ steps.last_release.outputs.tag_name }}
assets: "*.*"
- name: "Publish a release"
uses: softprops/action-gh-release@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag_name: ${{ inputs.tag_name }}
name: ${{ steps.prepare_release_data.outputs.release_name }}
body: ${{ steps.prepare_release_data.outputs.changelog }}
draft: ${{ inputs.draft == true || inputs.draft == 'true' }}
prerelease: ${{ inputs.prerelease == true || inputs.prerelease == 'true' }}
fail_on_unmatched_files: true
files: |
artifacts/*