chore: enable release candidates custom tokens #132
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: CI | |
on: | |
push: | |
branches: [develop] | |
pull_request: | |
branches: [develop] | |
workflow_dispatch: | |
inputs: | |
target_branch: | |
description: 'The branch to release from' | |
required: true | |
default: 'develop' | |
prerelease_token: | |
description: 'The prerelease token can be used when multiple users want to create release candidates. | |
One can define an own unique token to avoid conflicts: rc+<id>. For example: rc+xyz' | |
required: false | |
default: 'rc' | |
concurrency: | |
group: ${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
lint: | |
name: Check (Lint) Commit Messages and Files | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: 3.x | |
- uses: pre-commit/[email protected] | |
# Make sure commit messages follow the conventional commits convention: | |
# https://www.conventionalcommits.org | |
- uses: wagoid/commitlint-github-action@v5 | |
test: | |
name: Run Tests | |
runs-on: windows-latest | |
needs: | |
- lint | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: install tools, build and test | |
env: | |
# Workaround to force usage of scoop apps installed in USERPROFILE. | |
USER_PATH_FIRST: 1 | |
run: | | |
.\build.ps1 | |
shell: powershell | |
- name: Publish Test Results | |
uses: EnricoMi/publish-unit-test-result-action/windows@v2 | |
if: always() | |
with: | |
files: | | |
out/test-report.xml | |
release: | |
needs: | |
- test | |
- lint | |
runs-on: ubuntu-latest | |
environment: release | |
concurrency: release | |
permissions: | |
id-token: write | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.event.inputs.target_branch || github.head_ref || github.ref_name }} | |
- name: Determine Release Type | |
id: determine_release | |
run: | | |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then | |
echo "semantic_release_root_options=" >> $GITHUB_ENV | |
echo "prerelease=true" >> $GITHUB_ENV | |
elif [ "${{ github.ref_name }}" = "develop" ]; then | |
echo "semantic_release_root_options=" >> $GITHUB_ENV | |
echo "prerelease=false" >> $GITHUB_ENV | |
else | |
echo "semantic_release_root_options=--noop" >> $GITHUB_ENV | |
echo "prerelease=false" >> $GITHUB_ENV | |
fi | |
- name: Release | |
uses: python-semantic-release/[email protected] | |
id: release | |
with: | |
root_options: ${{ env.semantic_release_root_options }} | |
prerelease_token: ${{ github.event.inputs.prerelease_token }} | |
prerelease: ${{ env.prerelease }} | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Publish package distributions to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
if: steps.release.outputs.released == 'true' | |
- name: Publish package distributions to GitHub Releases | |
uses: python-semantic-release/upload-to-gh-release@main | |
if: steps.release.outputs.released == 'true' | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} |