Skip to content

Commit

Permalink
use version tag in (pre)release
Browse files Browse the repository at this point in the history
  • Loading branch information
jziolkowski committed Sep 15, 2024
1 parent d3a0a00 commit 97afc2a
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 71 deletions.
146 changes: 78 additions & 68 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,80 +1,90 @@
name: GitHub release

on:
workflow_dispatch:
push:
branches:
- master
- develop
paths-ignore:
- '.github/**'
- '**.md'
workflow_dispatch:
push:
branches:
- master
- develop
paths-ignore:
- '.github/**'
- '**.md'

jobs:
Binaries:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: windows-2019
arch: x86
- os: windows-2019
arch: x64
- os: macos-13
arch: x64

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: '3.8'
architecture: ${{ matrix.arch }}
Binaries:
runs-on: ${{ matrix.os }}
outputs:
version-tag: ${{ steps.version_tag.outputs.VERSION_TAG }}
strategy:
fail-fast: false
matrix:
include:
- os: windows-2019
arch: x86
- os: windows-2019
arch: x64
- os: macos-13
arch: x64

- name: Install PyInstaller
run: pip install -r requirements_build.txt
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python 3.8
uses: actions/setup-python@v4
with:
python-version: '3.8'
architecture: ${{ matrix.arch }}

- name: Build with PyInstaller
run: pyinstaller --noconfirm --clean tdmgr.spec
- name: Install PyInstaller
run: pip install -r requirements_build.txt

- name: Upload binaries artifact to workflow
uses: actions/upload-artifact@v3
with:
name: tdmgr
path: dist/*
- name: Retrieve version tag
id: version_tag
shell: bash
run: echo "VERSION_TAG=$(python -m setuptools_scm)" >> $GITHUB_OUTPUT

Draft-Release:
runs-on: ubuntu-latest
needs: Binaries
steps:
- uses: actions/checkout@v3
- name: Build with PyInstaller
run: pyinstaller --noconfirm --clean tdmgr.spec

# Create a draft release
- name: Create Draft Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref_name }}
release_name: TDM ${{ github.ref_name }}
draft: true
prerelease: ${{ github.ref_name == 'refs/heads/develop'}}
- name: Upload binaries artifact to workflow
uses: actions/upload-artifact@v3
with:
name: tdmgr
path: dist/*

- name: Download artifacts from build
uses: actions/download-artifact@v3
with:
path: dist
Draft-Release:
runs-on: ubuntu-latest
needs: Binaries
env:
VERSION_TAG: ${{ needs.Binaries.outputs.version-tag }}
steps:
- uses: actions/checkout@v3

# Upload release assets: each file in `dist/` to the GitHub Release
- name: Upload Release Assets
run: |
for asset in dist/tdmgr/*; do
echo "Uploading asset: $asset"
gh release upload "${{ github.ref_name }}" "$asset" --clobber
done
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Create a draft release
- name: Create Draft Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.VERSION_TAG }}
release_name: TDM ${{ env.VERSION_TAG }}
draft: ${{ github.ref_name != 'refs/heads/develop'}}
prerelease: ${{ github.ref_name == 'refs/heads/develop'}}


- name: Download artifacts from build
uses: actions/download-artifact@v3
with:
path: dist

# Upload release assets: each file in `dist/` to the GitHub Release
- name: Upload Release Assets
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
for asset in dist/tdmgr/*; do
echo "Uploading asset: $asset"
gh release upload ${{ env.VERSION_TAG }} "$asset" --clobber
done
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["setuptools>=42", "setuptools_scm>=6.0"]
requires = ["setuptools>=64", "setuptools-scm>=8"]
build-backend = "setuptools.build_meta"

[project]
Expand Down
3 changes: 2 additions & 1 deletion requirements_build.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
-r requirements.txt
pyinstaller>=4
setuptools_scm
setuptools>=64
setuptools-scm>=8
1 change: 0 additions & 1 deletion tdmgr/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ def configure_logging(args) -> None:
elif args.log_location:
log_path = os.path.join(args.log_location, "tdm.log")


logging.basicConfig(
level="DEBUG" if args.debug else "INFO",
datefmt="%Y-%m-%d %H:%M:%S",
Expand Down

0 comments on commit 97afc2a

Please sign in to comment.