-
Notifications
You must be signed in to change notification settings - Fork 0
111 lines (106 loc) · 3.49 KB
/
Copy pathrelease.yml
File metadata and controls
111 lines (106 loc) · 3.49 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
name: Release
# Publishes a release: verifies both editions, builds the binaries, and creates
# the GitHub release with them attached.
#
# Two ways in. Push a v* tag, or run it by hand with a version -- the manual
# path is the one this repository uses, because pushing a tag from the agent
# session is refused with a 403 (the session's grant covers branches, not tag
# refs). On that path `gh release create` makes the tag itself, with the
# repository's own token, at the commit the run started from.
#
# Nothing gets released past a red suite.
on:
push:
tags: ["v*"]
workflow_dispatch:
inputs:
version:
description: "Version to publish, e.g. v1.1"
required: true
permissions:
contents: write
jobs:
# A release that fails its own test suite is worse than no release.
verify:
runs-on: ubuntu-latest
env:
SDL_VIDEODRIVER: dummy
SDL_AUDIODRIVER: dummy
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Calculator edition
run: |
python3 tools/lint_globals.py src/nova*.py
python3 tools/fiximports.py --check
python3 tools/build.py
git diff --exit-code -- dist/
python3 tests/run_all.py
- name: PC edition
run: |
pip install pygame-ce numpy
python3 pc/tests/run_all.py
build:
needs: verify
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
asset: NOVA-windows.exe
built: pc/dist/NOVA.exe
- os: ubuntu-latest
asset: NOVA-linux
built: pc/dist/NOVA
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install
run: pip install pygame-ce numpy pyinstaller
- name: Draw the icon
working-directory: pc
run: python tools/make_icon.py
- name: Build
working-directory: pc
run: pyinstaller --noconfirm --clean nova.spec
- name: Name it for the platform
shell: bash
run: mv "${{ matrix.built }}" "${{ matrix.asset }}"
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.asset }}
path: ${{ matrix.asset }}
publish:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
merge-multiple: true
- name: Bundle the calculator edition
run: |
mkdir -p nova-numworks
cp dist/*.py nova-numworks/
cp docs/INSTALL.md nova-numworks/
zip -r nova-numworks.zip nova-numworks
- name: Publish
env:
GH_TOKEN: ${{ github.token }}
VERSION: ${{ github.event.inputs.version || github.ref_name }}
run: |
# On a manual run there is no tag yet, and `gh release create` makes
# one at the commit this ran on. That is the path this repository
# actually uses: pushing a tag from the agent session is refused with
# a 403 -- the session's grant covers branches, not tag refs -- so the
# repository creates its own tag with its own token.
gh release create "$VERSION" \
--target "$GITHUB_SHA" \
--title "NOVA $VERSION" \
--notes-file .github/RELEASE_NOTES.md \
NOVA-windows.exe NOVA-linux nova-numworks.zip