Skip to content

Commit df2ee24

Browse files
committed
add release workflow
1 parent 796d422 commit df2ee24

1 file changed

Lines changed: 89 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: Release
2+
on:
3+
push:
4+
branches:
5+
- main
6+
7+
workflow_dispatch:
8+
9+
jobs:
10+
create-release:
11+
12+
runs-on: ubuntu-latest
13+
name: Create Release
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
18+
- run: git fetch --tags origin
19+
20+
- name: Get previous tag
21+
id: previoustag
22+
uses: 'WyriHaximus/github-action-get-previous-tag@v1'
23+
env:
24+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25+
26+
- name: Next Monotonic Release version
27+
id: next
28+
uses: WyriHaximus/github-action-next-release-version@08a7476c98e8095fad1cce0e2344c7892e17d111
29+
with:
30+
version: ${{ steps.previoustag.outputs.tag }}
31+
32+
- name: Create Release
33+
uses: softprops/action-gh-release@v1
34+
if: ${{ github.event.inputs.version == '' }}
35+
with:
36+
tag_name: ${{ steps.next.outputs.version }}
37+
38+
39+
build:
40+
strategy:
41+
matrix:
42+
os: [ubuntu-latest, windows-latest]
43+
44+
runs-on: ${{ matrix.os }}
45+
46+
needs: create-release
47+
if: ${{ always() && !cancelled() && needs.create-release.result == 'success' }}
48+
steps:
49+
- name: Checkout
50+
uses: actions/checkout@v4
51+
52+
- name: Setup Python
53+
uses: actions/setup-python@v5
54+
with:
55+
python-version: '3.13'
56+
cache: 'pip'
57+
cache-dependency-path: 'requirements.txt'
58+
59+
- name: Install dependencies
60+
run: |
61+
python -m pip install -r requirements.txt
62+
63+
- run: |
64+
chmod +x ./build.sh
65+
./build.sh
66+
67+
shell: bash
68+
69+
- name: Pack files
70+
uses: TheDoctor0/zip-release@0.7.6
71+
with:
72+
filename: Release-${{ runner.os }}.zip
73+
directory: ./dist/
74+
75+
- run: git fetch --tags origin
76+
77+
- name: Get previous tag
78+
id: previoustag
79+
uses: 'WyriHaximus/github-action-get-previous-tag@v1'
80+
env:
81+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
82+
83+
- name: Upload to release
84+
uses: softprops/action-gh-release@v1
85+
if: ${{ github.event.inputs.version == '' }}
86+
with:
87+
tag_name: ${{ steps.previoustag.outputs.tag }}
88+
files: dist/Release-${{ runner.os }}.zip
89+
fail_on_unmatched_files: true

0 commit comments

Comments
 (0)