fix: release workflow

This commit is contained in:
PeriniM 2025-01-02 17:11:40 +01:00
parent 171b6dfaa3
commit cb6d140042

View File

@ -14,29 +14,42 @@ jobs:
run: | run: |
sudo apt update sudo apt update
sudo apt install -y git sudo apt install -y git
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install uv - name: Install uv
uses: astral-sh/setup-uv@v3 uses: astral-sh/setup-uv@v3
- name: Install Node Env - name: Install Node Env
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: 20 node-version: 20
- name: Checkout - name: Checkout
uses: actions/checkout@v4.1.1 uses: actions/checkout@v4.1.1
with: with:
fetch-depth: 0 fetch-depth: 0
persist-credentials: false persist-credentials: false
- name: Build app
- name: Install dependencies
run: | run: |
uv pip install build hatchling hatch-vcs
uv sync --frozen uv sync --frozen
uv build
- name: Build package
run: python -m build
id: build_cache id: build_cache
if: success()
- name: Cache build - name: Cache build artifacts
uses: actions/cache@v2 uses: actions/cache@v3
with: with:
path: ./dist path: |
key: ${{ runner.os }}-build-${{ hashFiles('dist/**') }} ./dist
if: steps.build_cache.outputs.id != '' ./build
key: ${{ runner.os }}-build-${{ github.sha }}
release: release:
name: Release name: Release
@ -44,10 +57,9 @@ jobs:
needs: build needs: build
environment: development environment: development
if: | if: |
github.event_name == 'push' && github.ref == 'refs/heads/main' || github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/pre/')) ||
github.event_name == 'push' && github.ref == 'refs/heads/pre/beta' || github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged &&
github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged && github.event.pull_request.base.ref == 'main' || (github.event.pull_request.base.ref == 'main' || startsWith(github.event.pull_request.base.ref, 'pre/'))
github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged && github.event.pull_request.base.ref == 'pre/beta'
permissions: permissions:
contents: write contents: write
issues: write issues: write
@ -59,6 +71,15 @@ jobs:
with: with:
fetch-depth: 0 fetch-depth: 0
persist-credentials: false persist-credentials: false
- name: Restore build artifacts
uses: actions/cache@v3
with:
path: |
./dist
./build
key: ${{ runner.os }}-build-${{ github.sha }}
- name: Semantic Release - name: Semantic Release
uses: cycjimmy/semantic-release-action@v4.1.0 uses: cycjimmy/semantic-release-action@v4.1.0
with: with: