Skip to content

Extracting changelog fixed #90

Extracting changelog fixed

Extracting changelog fixed #90

Workflow file for this run

name: Create release
on:
workflow_dispatch:
inputs:
sha:
description: "Commit SHA to create release from"
required: true
tag:
description: "Tag of the release"
required: true
push:
tags:
- 'v*'
jobs:
version-check:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Check package versions
run: python scripts/check_package_versions.py
set-env:
needs: [ version-check ]
runs-on: ubuntu-latest
outputs:
sha: ${{ env.SHA }}
tag: ${{ env.TAG }}
prerelease: ${{ env.PRERELEASE }}
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Set env on push
if: github.event_name == 'push'
run: |
echo "SHA=$(git rev-parse HEAD)" >> $GITHUB_ENV
echo "TAG=$(git tag --points-at HEAD)" >> $GITHUB_ENV
- name: Set env on trigger
if: github.event_name == 'workflow_dispatch'
run: |
echo "SHA=${{ github.event.inputs.sha }}" >> $GITHUB_ENV
echo "TAG=${{ github.event.inputs.tag }}" >> $GITHUB_ENV
- name: Set env if version is pre-release
run: |
echo "PRERELEASE=${{ toJSON(contains(env.TAG, '-')) }}" >> $GITHUB_ENV
- name: Check values
run: |
echo "SHA: ${{ env.SHA }}"
echo "Tag: ${{ env.TAG }}"
echo "Pre-release: ${{ env.PRERELEASE }}"
build-artifacts:
needs: [ set-env ]
uses: ./.github/workflows/build.yml
with:
version: ${{ needs.set-env.outputs.tag }}
sha: ${{ needs.set-env.outputs.sha }}
create-release:
runs-on: ubuntu-latest
needs: [ set-env, build-artifacts ]
steps:
- name: Checkout sources
uses: actions/checkout@v2
with:
ref: ${{ needs.set-env.outputs.sha }}
- name: Generate changelog
run: python3 scripts/extract_changelog.py ${{ needs.set-env.outputs.tag }} > generated-changelog.md
- name: Download artifacts
uses: actions/download-artifact@v3
- name: Create release
uses: ncipollo/release-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ needs.set-env.outputs.tag }}
name: ${{ needs.set-env.outputs.tag }}
bodyFile: generated-changelog.md
commit: ${{ needs.set-env.outputs.sha }}
allowUpdates: true
prerelease: ${{ fromJSON(needs.set-env.outputs.prerelease) }}
removeArtifacts: true
artifacts: archive-*/**
upload-python-wheel:
runs-on: ubuntu-latest
needs: [ set-env, create-release ]
if: ${{ !fromJSON(needs.set-env.outputs.prerelease) }}
steps:
- name: Download archive
uses: actions/download-artifact@v3
- name: Install twine
run: python -m pip install twine
- name: Upload wheel
run: python -m twine upload --username __token__ --password ${{ secrets.PYPI_UPLOAD_TOKEN }} archive-pyhq/*