Repository navigation
131 lines (120 loc) · 4.43 KB
/
Copy pathTerminalNightly.yml
File metadata and controls
131 lines (120 loc) · 4.43 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
name: 'Terminal release'
# Self-contained builds of the Terminal for seven runtimes, zipped, and .debs for Linux,
# attached to each release of the packages, whose version they carry, read from the release's
# tag as Nuget.yml reads it. Run by hand, it builds and packs without attaching anything unless
# asked to, and a pull request that touches the workflow or its scripts builds and packs the
# same way. Only the job that attaches the builds can write to the repository, and it runs no
# code from it.
# https://github.com/asc-community/AngouriMath/issues/539
on:
release:
types: [published]
pull_request:
paths:
- '.github/workflows/TerminalNightly.yml'
- 'Sources/Terminal/AngouriMath.Terminal/publish.sh'
- 'Sources/Terminal/AngouriMath.Terminal/pack-deb-linux.sh'
- 'Sources/Terminal/AngouriMath.Terminal/amcli.1'
- 'Sources/Terminal/AngouriMath.Terminal/amcli.bash'
workflow_dispatch:
inputs:
version:
description: 'The version to pack, and to release under if releasing'
type: string
default: '0.0.0'
release:
description: 'Attach the build to the release of that version, which has to exist'
type: boolean
default: false
jobs:
TerminalBuild:
runs-on: ubuntu-latest
permissions:
contents: read
outputs:
tag: ${{ steps.version.outputs.tag }}
steps:
- uses: actions/checkout@v6
with:
submodules: 'recursive'
- name: Setup .NET 10
uses: actions/setup-dotnet@v5
with:
dotnet-version: '10.x'
dotnet-quality: 'preview'
# The release's tag without its 'v', as Nuget.yml reads it, so that the Terminal is released
# under the packages' version; by hand, the version asked for; for a pull request, 0.0.0.
- name: 'Determine version'
id: version
env:
TAG: ${{ github.event.release.tag_name }}
ASKED: ${{ inputs.version }}
run: |
if [ "${{ github.event_name }}" = 'release' ]; then
version="${TAG#v}"
tag="$TAG"
else
version="${ASKED:-0.0.0}"
tag="v$version"
fi
if [[ ! "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$ ]]; then
echo "Error: '$version' is not a version such as 2.6.0 or 2.6.0-beta.1"
exit 1
fi
echo "Version: $version"
echo "version=$version" >> "$GITHUB_OUTPUT"
echo "tag=$tag" >> "$GITHUB_OUTPUT"
- name: 'Build terminal'
env:
TERMINAL_VERSION: ${{ steps.version.outputs.version }}
run: |
cd Sources/Terminal/AngouriMath.Terminal
./publish.sh
./pack-deb-linux.sh
# Zipped from inside publish-output, so that an archive holds its runtime's folder and not
# the repository's path to it.
- name: 'Pack'
run: |
cd Sources/Terminal/AngouriMath.Terminal/publish-output
for arch in linux-x64 linux-arm linux-arm64 win-x64 win-x86 osx-x64 osx-arm64
do
zip -qr "$GITHUB_WORKSPACE/angourimath-terminal-${arch}.zip" "$arch"
done
cp angourimath-terminal-*.deb "$GITHUB_WORKSPACE"
- name: 'Keep the packages'
uses: actions/upload-artifact@v4
with:
name: angourimath-terminal
retention-days: 7
path: |
angourimath-terminal-*.zip
angourimath-terminal-*.deb
# Replaces an asset of the same name, so that a run repeated for one release leaves one set.
TerminalRelease:
needs: TerminalBuild
if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && inputs.release)
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/download-artifact@v4
with:
name: angourimath-terminal
- name: 'Attach to the release'
env:
GH_TOKEN: ${{ github.token }}
TAG: ${{ needs.TerminalBuild.outputs.tag }}
run: |
gh release upload "$TAG" \
'angourimath-terminal-linux-x64.zip' \
'angourimath-terminal-linux-arm.zip' \
'angourimath-terminal-linux-arm64.zip' \
'angourimath-terminal-win-x64.zip' \
'angourimath-terminal-win-x86.zip' \
'angourimath-terminal-osx-x64.zip' \
'angourimath-terminal-osx-arm64.zip' \
'angourimath-terminal-amd64.deb' \
'angourimath-terminal-arm.deb' \
'angourimath-terminal-arm64.deb' \
-R "$GITHUB_REPOSITORY" \
--clobber