Skip to content

Commit 68d7e07

Browse files
committed
add initial release workflow
1 parent 61fb86d commit 68d7e07

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+
build:
39+
strategy:
40+
matrix:
41+
os: [ubuntu-latest, windows-latest]
42+
43+
runs-on: ${{ matrix.os }}
44+
45+
needs: create-release
46+
if: ${{ always() && !cancelled() && needs.create-release.result == 'success' }}
47+
steps:
48+
- name: Checkout
49+
uses: actions/checkout@v4
50+
51+
- name: Setup Python
52+
uses: actions/setup-python@v5
53+
with:
54+
python-version: '3.13'
55+
cache: 'pip'
56+
cache-dependency-path: 'requirements.txt'
57+
58+
- name: Install dependencies
59+
run: |
60+
python -m pip install -r requirements.txt
61+
62+
python -m pip install PyInstaller
63+
64+
- run: |
65+
python -m PyInstaller --distpath dist/ -y captioncompiler.spec
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)