-
-
Notifications
You must be signed in to change notification settings - Fork 0
164 lines (142 loc) · 7.46 KB
/
release.yml
File metadata and controls
164 lines (142 loc) · 7.46 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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
name: Release Build
on:
release:
types: [published]
workflow_dispatch:
inputs:
version_type:
type: choice
description: 'Version Type'
required: true
default: rebuild
options:
- rebuild
- patch
- minor
- major
jobs:
bump_version:
name: Bump Version
runs-on: ubuntu-latest
permissions: write-all
outputs:
current_version: ${{ steps.get_version.outputs.current_version }}
new_version: ${{ steps.bump.outputs.current-version || steps.bump_manual.outputs.current-version }}
steps:
- uses: actions/checkout@v4
- name: Get current version
id: get_version
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.version_type == 'rebuild' }}
run: |
pip install bump-my-version
echo "current_version=$(bump-my-version show current_version)" >> $GITHUB_OUTPUT
- name: Bump version
id: bump
uses: callowayproject/bump-my-version@master
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.version_type != 'rebuild' }}
with:
args: ${{ inputs.version_type }}
- name: Bump version (Manual)
id: bump_manual
uses: callowayproject/bump-my-version@master
if: ${{ github.event_name == 'release' }}
with:
args: --new-version ${{ github.ref_name }}
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
activate-environment: true
- name: Update lockfile
run: uv lock
- name: Commit version bump
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.version_type != 'rebuild' && steps.bump.outputs.bumped == 'true' }}
uses: EndBug/add-and-commit@v9
with:
default_author: github_actions
message: "Bump version: ${{ steps.bump.outputs.previous-version }} → ${{ steps.bump.outputs.current-version }}"
push: false # Temporarily push manually because of (https://github.com/EndBug/add-and-commit/issues/713)
tag: "v${{ steps.bump.outputs.current-version }}"
tag_push: "--force"
- name: Commit version bump (Manual)
if: ${{ github.event_name == 'release' && steps.bump.outputs.bumped == 'true' }}
uses: EndBug/add-and-commit@v9
with:
default_author: github_actions
message: "Bump version: ${{ steps.bump.outputs.previous-version }} → ${{ steps.bump.outputs.current-version }}"
push: false # Temporarily push manually because of (https://github.com/EndBug/add-and-commit/issues/713)
tag: "v${{ steps.bump.outputs.current-version }}"
tag_push: "--force"
- uses: ad-m/github-push-action@master
name: Push changes
if: ${{ steps.bump.outputs.bumped == 'true' }}
with:
force: true
tags: true
build:
name: Build for ${{ matrix.osname }}
permissions: write-all
runs-on: ${{ matrix.os }}
needs: bump_version
strategy:
matrix:
include:
- os: ubuntu-latest
osname: Linux
osext: ""
- os: macos-latest
osname: macOS
osext: ""
- os: windows-latest
osname: Windows
osext: ".exe"
steps:
- uses: actions/checkout@v4
if: ${{ github.event_name == 'release' || github.event.inputs.version_type == 'rebuild' }}
- uses: actions/checkout@v4
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.version_type != 'rebuild' }}
with:
ref: v${{ needs.bump_version.outputs.new_version }}
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.13
- name: Install dependencies
run: pip install .
- id: repo_name
name: Get repository name
uses: ASzc/change-string-case-action@v6
with:
string: ${{ github.event.repository.name }}
- name: Build executable
uses: Nuitka/Nuitka-Action@main
with:
mode: onefile
script-name: src/${{ steps.repo_name.outputs.lowercase }}
output-dir: build
output-file: ${{ github.event.repository.name }}_v${{ needs.bump_version.outputs.new_version || needs.bump_version.outputs.current_version }}_${{ matrix.osname }}
company-name: ${{ github.repository_owner }}
product-name: ${{ github.event.repository.name }}
file-description: ${{ github.event.repository.name }} for ${{ matrix.osname }} (version ${{ needs.bump_version.outputs.new_version || needs.bump_version.outputs.current_version }})
file-version: ${{ needs.bump_version.outputs.new_version || needs.bump_version.outputs.current_version }}
product-version: ${{ needs.bump_version.outputs.new_version || needs.bump_version.outputs.current_version }}
copyright: "Copyright (c) 2026 ${{ github.repository_owner }}"
include-package: rich._unicode_data
- name: Upload release (manual)
if: ${{ github.event_name == 'release' && matrix.os != 'windows-latest' }}
uses: softprops/action-gh-release@v2
with:
files: build/${{ github.event.repository.name }}_v${{ needs.bump_version.outputs.new_version || needs.bump_version.outputs.current_version }}_${{ matrix.osname }}${{ matrix.osext }}
- name: Upload release
if: ${{ github.event_name == 'workflow_dispatch' && matrix.os != 'windows-latest' }}
uses: softprops/action-gh-release@v2
with:
files: build/${{ github.event.repository.name }}_v${{ needs.bump_version.outputs.new_version || needs.bump_version.outputs.current_version }}_${{ matrix.osname }}${{ matrix.osext }}
tag_name: v${{ needs.bump_version.outputs.new_version || needs.bump_version.outputs.current_version }}
- name: Upload windows release for code signing
if: ${{ matrix.os == 'windows-latest' }}
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
AWS_ENDPOINT_URL: ${{ secrets.AWS_ENDPOINT_URL }}
run: aws s3 cp ./build/${{ github.event.repository.name }}_v${{ needs.bump_version.outputs.new_version || needs.bump_version.outputs.current_version }}_${{ matrix.osname }}${{ matrix.osext }} s3://builds/unsigned/${{ github.event.repository.name }}/v${{ needs.bump_version.outputs.new_version || needs.bump_version.outputs.current_version }}/${{ github.event.repository.name }}_v${{ needs.bump_version.outputs.new_version || needs.bump_version.outputs.current_version }}_${{ matrix.osname }}${{ matrix.osext }}