fix: enforce venv activation in docker command #94
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 | |
with: | |
submodules: recursive | |
- name: Install uv | |
run: | | |
uv_version=$(cat ./requirement-uv.txt | awk -F'==' '{print $2}' | tr -d ' \n') | |
curl -LsSf https://astral.sh/uv/${uv_version}/install.sh | sh | |
- name: Record original PATH | |
id: record_original_path | |
run: echo "PATH_ORIGINAL=$PATH" >> $GITHUB_OUTPUT | |
- name: Activate .venv | |
run: | | |
uv sync --frozen --no-install-project | |
. .venv/bin/activate | |
echo PATH=${GITHUB_WORKSPACE}/.venv/bin:$PATH >> $GITHUB_ENV | |
- name: Build And Assemble | |
run: | | |
export PYTHONPATH=$(pwd) | |
python3 scripts/common/py/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" | |
- name: Deactivate .venv | |
run: echo PATH=${{ steps.record_original_path.outputs.PATH_ORIGINAL }} | |
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/common/py/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" |