Simplify prerelease action merge commit detection.

This commit is contained in:
Lars Holmberg 2024-08-20 12:08:03 +02:00
parent d82e4b322c
commit 553ecdc309
1 changed files with 9 additions and 9 deletions

View File

@ -251,40 +251,40 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
# asking github if something was not a merge commit is surprisingly difficult
- run: git rev-parse HEAD^2 2>/dev/null >/dev/null || echo NOT_MERGE_COMMIT=1 | tee -a $GITHUB_ENV
# asking github if something was a merge commit is surprisingly difficult
- run: git rev-parse HEAD^2 2>/dev/null >/dev/null && echo MERGE_COMMIT=1 | tee -a $GITHUB_ENV || true
- name: Set up Python
if: ${{ env.NOT_MERGE_COMMIT == '' }}
if: env.MERGE_COMMIT
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Set Node.js 20.x
if: ${{ env.NOT_MERGE_COMMIT == '' }}
if: env.MERGE_COMMIT
uses: actions/setup-node@v4
with:
node-version: 20.x
- name: Install Yarn
if: ${{ env.NOT_MERGE_COMMIT == '' }}
if: env.MERGE_COMMIT
run: npm install -g yarn
- name: Install dependencies
if: ${{ env.NOT_MERGE_COMMIT == '' }}
if: env.MERGE_COMMIT
run: |
python -m pip install --upgrade pip poetry
python -m poetry config virtualenvs.create false
python -m poetry self add "poetry-dynamic-versioning[plugin]"
# Pre-build the UI bundle and don't repeat it on the build step to allow sdist to find the files
- name: Prebuild UI
if: ${{ env.NOT_MERGE_COMMIT == '' }}
if: env.MERGE_COMMIT
run: |
yarn webui:install
yarn webui:build
- name: Build
if: ${{ env.NOT_MERGE_COMMIT == '' }}
if: env.MERGE_COMMIT
run: |
SKIP_PRE_BUILD=true python -m poetry build
./rename-wheel.sh
- name: Publish prerelease version to PyPI
if: ${{ env.NOT_MERGE_COMMIT == '' }}
if: env.MERGE_COMMIT
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__