-
Notifications
You must be signed in to change notification settings - Fork 17
96 lines (78 loc) · 2.74 KB
/
release.yml
File metadata and controls
96 lines (78 loc) · 2.74 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
name: Build, upload artifact and create release
on:
push:
tags:
- "*.*.*"
pull_request:
types: [opened, reopened, synchronize, ready_for_review, labeled]
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install dependencies
run: pip3 install -r requirements.txt
- name: Install PyInstaller
run: pip install pyinstaller
- name: Create PyInstaller spec file
run: pyi-makespec --onefile dance.py
- name: Edit PyInstaller spec file to include static folder
shell: pwsh
run: |
$specFile = Get-Content dance.spec
$specFile = $specFile -replace "datas=\[\]", "datas=[('static', 'static')]"
$specFile | Set-Content dance.spec
- name: Build executable
run: pyinstaller dance.spec
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: joydance-win64-executable
path: dist/dance.exe
test_run_artifact:
needs: build
runs-on: windows-latest
steps:
- uses: actions/download-artifact@v4
with:
name: joydance-win64-executable
path: ./dist
- name: Run the artifact
run: |
Start-Process -FilePath "./dist/dance.exe"
Start-Sleep -Seconds 30 # Run for 30 seconds
Stop-Process -Name "dance" # Replace with the actual process name if different
shell: pwsh
create_release:
needs: test_run_artifact
runs-on: ubuntu-latest
if: ${{ startsWith(github.ref, 'refs/tags/') }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Determine Tags to use for changelog
id: determine_tags
run: |
# Get the latest tag
LATEST_TAG=$(git describe --tags --abbrev=0)
# Get the tag before the latest tag
PREVIOUS_TAG=$(git describe --tags --abbrev=0 $LATEST_TAG^)
echo "Latest tag: $LATEST_TAG"
echo "Previous tag: $PREVIOUS_TAG"
echo "PREVIOUS_TAG=$PREVIOUS_TAG" >> $GITHUB_ENV
echo "LATEST_TAG=$LATEST_TAG" >> $GITHUB_ENV
- name: Create Changelog
run: git log --pretty=format:"%h - %s (@%an)" $PREVIOUS_TAG..$LATEST_TAG > ${{ github.workspace }}-${{ github.env.LATEST_TAG }}-CHANGELOG.txt
- uses: actions/download-artifact@v4
with:
name: joydance-win64-executable
path: ./dist
- uses: softprops/action-gh-release@v2
with:
files: ./dist/dance.exe
body_path: ${{ github.workspace }}-${{ github.env.LATEST_TAG }}-CHANGELOG.txt
tag_name: ${{ github.env.LATEST_TAG }}