Skip to content

Release

Release #4

Workflow file for this run

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 }}