-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d3d1bec
commit 28a7144
Showing
3 changed files
with
350 additions
and
306 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
name: Release | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: write | ||
discussions: write | ||
packages: read | ||
|
||
jobs: | ||
build-windows: | ||
name: Build (Windows) | ||
runs-on: windows-latest | ||
defaults: | ||
run: | ||
shell: bash | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.12' | ||
|
||
- name: Install Rust | ||
run: rustup update | ||
|
||
- name: Install requirements | ||
run: pip install -r requirements.txt | ||
|
||
- name: Install UPX | ||
uses: crazy-max/ghaction-upx@v2 | ||
with: | ||
install-only: true | ||
|
||
- name: Get name and version | ||
id: get_info | ||
run: | | ||
NAME=$(python build.py --name) | ||
VERSION=$(python build.py --version) | ||
echo "NAME=${NAME}" >> $GITHUB_OUTPUT | ||
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT | ||
- name: Package binary | ||
run: | | ||
maturin develop --release | ||
python build.py | ||
- name: Rename binary | ||
run: mv "${{ steps.get_info.outputs.NAME }}-v${{ steps.get_info.outputs.VERSION }}.exe" "${{ steps.get_info.outputs.NAME }}-v${{ steps.get_info.outputs.VERSION }}-win-x86_64.exe" | ||
|
||
- uses: actions/upload-artifact@v3 | ||
name: Upload binary artifact | ||
with: | ||
name: windows-binary | ||
retention-days: 3 | ||
path: "${{ steps.get_info.outputs.NAME }}-v${{ steps.get_info.outputs.VERSION }}-win-x86_64.exe" | ||
|
||
publish-release: | ||
name: Publish GitHub release | ||
runs-on: ubuntu-latest | ||
needs: build-windows | ||
defaults: | ||
run: | ||
shell: bash | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.12' | ||
|
||
- name: Install Rust | ||
run: rustup update | ||
|
||
- name: Install requirements | ||
run: pip install -r requirements.txt | ||
|
||
- name: Get name and version | ||
id: get_info | ||
run: | | ||
NAME=$(python build.py --name) | ||
VERSION=$(python build.py --version) | ||
echo "NAME=${NAME}" >> $GITHUB_OUTPUT | ||
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT | ||
- name: Create binary folders | ||
run: mkdir -p windows-binary | ||
|
||
- name: Download Windows binary | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: windows-binary | ||
path: windows-binary | ||
|
||
- uses: mukunku/tag-exists-action@v1.2.0 | ||
name: Check if this version was already released | ||
id: checkTag | ||
with: | ||
tag: 'v${{ steps.get_info.outputs.VERSION }}' | ||
|
||
- name: Terminate if this version was already released | ||
if: steps.checkTag.outputs.exists == 'true' | ||
run: | | ||
echo "v${{ steps.get_info.outputs.VERSION }} was already released!" >&2 | ||
exit 1 | ||
- name: Create release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
body: | | ||
### **_${{ steps.get_info.outputs.NAME }}-v${{ steps.get_info.outputs.VERSION }}_** | ||
draft: false | ||
prerelease: false | ||
files: | | ||
windows-binary/${{ steps.get_info.outputs.NAME }}-v${{ steps.get_info.outputs.VERSION }}-win-x86_64.exe | ||
name: v${{ steps.get_info.outputs.VERSION }} | ||
tag_name: v${{ steps.get_info.outputs.VERSION }} | ||
fail_on_unmatched_files: true | ||
token: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.