build executable in "release" workflow #4
Workflow file for this run
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
name: Release tagged build | |
on: | |
push: | |
tags: [ '*' ] | |
permissions: | |
contents: write | |
jobs: | |
build: | |
runs-on: windows-latest | |
env: | |
VERSION: ${{ github.ref_name }} | |
RELEASE_VERSION: ${{ github.ref_name }} | |
SNAPSHOT: ${{ endsWith(github.ref_name, '-snapshot') || contains(github.event.head_commit.message, '[snapshot]') }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Create Executable | |
uses: sayyid5416/pyinstaller@v1 | |
with: | |
python_ver: '3.12' | |
pyinstaller_ver: '==5.13.2' | |
spec: 'downloader.spec' | |
requirements: 'requirements.txt' | |
upload_exe_with_name: 'downloader.exe' | |
options: --onefile, --name "Steam Workshop Downloader", --windowed, | |
- name: Delete old release if it already exists | |
run: gh release delete --yes "${RELEASE_VERSION}" | |
continue-on-error: true | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Release under current tag | |
run: | | |
PRERELEASE="" | |
if [[ "$SNAPSHOT" == "true" ]]; then | |
PRERELEASE="--prerelease" | |
fi | |
export "CHANGELOG_FILE=$(mktemp --suffix=.md)" | |
echo "CHANGELOG_FILE=${CHANGELOG_FILE}" >> $GITHUB_ENV | |
gh api --method POST -H "Accept: application/vnd.github+json" \ | |
"repos/${GITHUB_REPOSITORY}/releases/generate-notes" \ | |
-f tag_name="${RELEASE_VERSION}" \ | |
--jq ".body" > "${CHANGELOG_FILE}" | |
cat "${CHANGELOG_FILE}" | |
gh release create "${RELEASE_VERSION}" -F "${CHANGELOG_FILE}" $PRERELEASE ./dist/* | |
shell: bash | |
continue-on-error: true | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |