Repository navigation
111 lines (96 loc) · 3.03 KB
/
Copy pathrelease.yml
File metadata and controls
111 lines (96 loc) · 3.03 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
on:
push:
tags: ["v*"]
permissions:
contents: read
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false
jobs:
build:
name: Build Windows portable
runs-on: windows-latest
env:
PYTHONUTF8: "1"
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: "3.13"
cache: pip
cache-dependency-path: |
pyproject.toml
requirements.txt
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
python -m pip install -e ".[dev,build]"
- name: Check tag matches application version
id: version
shell: bash
run: |
version=$(python -c "import enderlitplayer; print(enderlitplayer.__version__)")
if [ "v${version}" != "${GITHUB_REF_NAME}" ]; then
echo "Tag ${GITHUB_REF_NAME} does not match application version ${version}" >&2
exit 1
fi
echo "version=${version}" >> "$GITHUB_OUTPUT"
- name: Validate
env:
QT_QPA_PLATFORM: offscreen
run: |
python scripts/check_package.py imports
python -m ruff check src tests scripts
python -m pytest -q
- name: Build portable distribution
run: python scripts/build_windows.py
- name: Upload artifacts
uses: actions/upload-artifact@v7
with:
name: windows-portable
path: |
dist/EnderlitPlayer-${{ steps.version.outputs.version }}-Windows-Portable.zip
dist/SHA256SUMS.txt
if-no-files-found: error
retention-days: 14
publish:
name: Publish GitHub Release
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v6
- uses: actions/download-artifact@v8
with:
name: windows-portable
path: release
- name: Verify checksums
working-directory: release
run: |
test -f "EnderlitPlayer-${{ needs.build.outputs.version }}-Windows-Portable.zip"
sha256sum --check SHA256SUMS.txt
- name: Extract release notes
run: |
version="${{ needs.build.outputs.version }}"
awk -v h="## [${version}]" '
index($0, h) == 1 {found=1; next}
found && /^## \[/ {exit}
found {print}
' CHANGELOG.md > release-notes.md
test -s release-notes.md
- name: Create release
env:
GH_TOKEN: ${{ github.token }}
run: |
version="${{ needs.build.outputs.version }}"
gh release create "${GITHUB_REF_NAME}" \
"release/EnderlitPlayer-${version}-Windows-Portable.zip" \
"release/SHA256SUMS.txt" \
--title "EnderlitPlayer ${version}" \
--notes-file release-notes.md \
--verify-tag