build and release #57
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: build and release | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
inputs: | |
isPrerelease: | |
description: "Select whether this is pre-release" | |
required: true | |
default: "false" | |
type: choice | |
options: | |
- "true" | |
- "false" | |
permissions: | |
contents: write | |
env: | |
IS_PRERELEASE: ${{ github.event.inputs.isPrerelease || false }} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.12" | |
- name: Build And Assemble | |
run: | | |
python3 -m pip install poetry | |
python3 -m poetry config virtualenvs.create false | |
python3 -m poetry install --no-root | |
export PYTHONPATH=$(pwd) | |
python3 scripts/run_tests.py | |
python3 scripts/multi_build.py | |
- name: Publish Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: build-artifacts | |
path: "multi-build" | |
retention-days: 1 | |
if-no-files-found: "error" | |
release: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Retrieve artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: build-artifacts | |
path: "multi-build" | |
- name: Get current version | |
id: version | |
run: echo "version=$(python3 scripts/get_version.py)" >> $GITHUB_OUTPUT | |
- name: Form a tag name | |
id: tagname | |
run: echo "tagname=v${{ steps.version.outputs.version }}" >> $GITHUB_OUTPUT | |
- name: Release | |
uses: ncipollo/release-action@v1 | |
with: | |
draft: true | |
skipIfReleaseExists: true | |
tag: ${{ steps.tagname.outputs.tagname }} | |
prerelease: ${{ env.IS_PRERELEASE }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
artifacts: "multi-build/*.zip" |