-
Notifications
You must be signed in to change notification settings - Fork 93
80 lines (75 loc) · 2.95 KB
/
release.yml
File metadata and controls
80 lines (75 loc) · 2.95 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
# Copyright (C) 2005 - 2026 Settlers Freaks <sf-team at siedler25.org>
#
# SPDX-License-Identifier: GPL-2.0-or-later
name: Create Release
permissions:
contents: write
on:
push:
tags:
- 'v*'
concurrency:
group: ${{format('release-{0}:{1}', github.repository, github.ref)}}
cancel-in-progress: true
jobs:
release:
name: Create Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Extract tag name
id: get_tag
run: echo "::set-output name=tag::${GITHUB_REF#refs/tags/}"
- name: Set filenames
id: filenames
run: |
echo "::set-output name=src::s25client_src_${{steps.get_tag.outputs.tag}}.tar.gz"
echo "::set-output name=devTools::s25client_dev-tools_${{steps.get_tag.outputs.tag}}.tar.gz"
- name: Create source distribution
run: |
set -x
git submodule update --init
git rev-parse HEAD > revision.txt
NAME="s25client_${{steps.get_tag.outputs.tag}}"
mkdir "/tmp/$NAME"
cp -r * .clang-format .clang-tidy "/tmp/$NAME"
mv "/tmp/$NAME" .
# Cleanup
rm -r "$NAME"/{appveyor.yml,codecov.yml,Jenkinsfile,tools/ci}
find "$NAME" -name '.git*' -exec rm -rv {} \; || true
tar -czf ${{steps.filenames.outputs.devTools}} "$NAME/external/dev-tools"
rm -r "$NAME/external/dev-tools"/*
tar -czf ${{steps.filenames.outputs.src}} "$NAME"
- name: Get tag message
run: |
tagName=${{steps.get_tag.outputs.tag}}
tagType=$(git cat-file -t $tagName)
if [[ "$tagType" == "tag" ]]; then
tagMsg="$(git tag -l --format='%(contents)' $tagName)"
# Make sure to keep newlines and add an empty line before and after the message for better formatting
echo "TAG_MSG<<EOF" >> $GITHUB_ENV
echo "" >> $GITHUB_ENV
echo "$tagMsg" >> $GITHUB_ENV
echo "" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
else
echo "TAG_MSG=" >> $GITHUB_ENV
fi
- name: Create Release
id: create_release
uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b # v2.5.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag_name: ${{ github.ref }}
name: Release ${{ github.ref }}
body: |
Return To The Roots (Settlers II(R) Clone)
${{ env.TAG_MSG }}
- ${{steps.filenames.outputs.src}} contains all source files including the submodules
- ${{steps.filenames.outputs.devTools}} contains optional binaries for development. Extract over the source folder if required
draft: false
prerelease: false
files: |
${{steps.filenames.outputs.src}}
${{steps.filenames.outputs.devTools}}
fail_on_unmatched_files: true