-
Notifications
You must be signed in to change notification settings - Fork 7
112 lines (94 loc) · 3.06 KB
/
deploy.yml
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
name: Build and Release
on:
push:
branches:
- "main"
jobs:
build:
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Install dependencies
run: pip install -r ./package/requirements.txt
# - name: Generate Release Notes from PRs
# uses: actions/github-script@v6
# id: generate_pr_notes
# with:
# script: |
# const { data: pulls } = await github.rest.pulls.list({
# owner: context.repo.owner,
# repo: context.repo.repo,
# state: "closed",
# base: context.ref
# });
# const notes = pulls
# .filter(pr => pr.merged_at)
# .map(pr => `- ${pr.title} (#${pr.number})`)
# .join("\n");
# return notes;
# result-encoding: string
- name: Install Inno Setup
run: |
curl -L -o innosetup.exe "https://jrsoftware.org/download.php/is.exe"
cmd /c "innosetup.exe /VERYSILENT /NORESTART"
- name: Extract Version from _version.py
id: extract_version
run: |
$VERSION = python -c "from tik_manager4 import _version; print(_version.__version__)"
echo "VERSION=$VERSION" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8
shell: pwsh
- name: Debug Version
run: echo "Extracted version is ${{ env.VERSION }}"
- name: Check if Release Tag Exists
id: check_tag
run: |
git fetch --tags
if git rev-parse "v${{ env.VERSION }}" >/dev/null 2>&1; then
echo "Error: Tag v${{ env.VERSION }} already exists."
exit 1
fi
shell: bash
- name: Build and Package
run: |
cd package
./make release
- name: List Build Directory
run: dir package\build
shell: cmd
- name: Verify the Built File
run: |
if not exist "package\build\TikManager4_v${{ env.VERSION }}.exe" exit 1
shell: cmd
- name: Read Sanitized Release Notes
id: read_release_notes
run: |
sanitized_notes_file="package/build/ReleaseNotes_v${{ env.VERSION }}.md"
if [ ! -f "$sanitized_notes_file" ]; then
echo "Error: Sanitized release notes not found: $sanitized_notes_file"
exit 1
fi
release_notes=$(cat "$sanitized_notes_file")
echo "release_notes<<EOF" >> $GITHUB_ENV
echo "$release_notes" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
shell: bash
- name: Upload Release Assets
uses: actions/upload-artifact@v3
with:
name: TikManager4
path: package/build/TikManager4_v${{ env.VERSION }}.exe
- name: Create GitHub Release
uses: ncipollo/release-action@v1
with:
artifacts: package/build/TikManager4_v${{ env.VERSION }}.exe
token: ${{ secrets.GITHUB_TOKEN }}
tag: v${{ env.VERSION }}
name: v${{ env.VERSION }}
body: |
## What's Changed
${{ env.release_notes }}