Skip to content

Commit b5a39cc

Browse files
chore: change release to workflow_dispatch
- Update release mechanism to manually triggered - Split semantic release dry run workflow
1 parent 0824d66 commit b5a39cc

File tree

4 files changed

+125
-109
lines changed

4 files changed

+125
-109
lines changed

.github/workflows/release.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Release
2+
3+
on: workflow_dispatch
4+
5+
jobs:
6+
pre-commit:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v4
10+
11+
- uses: actions/setup-python@v5
12+
with:
13+
python-version: "3.10"
14+
15+
# Install and run pre-commit
16+
- run: |
17+
pip install pre-commit
18+
pre-commit install
19+
pre-commit run --all-files
20+
21+
release:
22+
needs: [pre-commit]
23+
runs-on: ubuntu-latest
24+
environment:
25+
name: pypi
26+
url: https://pypi.org/p/trame-slicer
27+
permissions:
28+
id-token: write # IMPORTANT: mandatory for trusted publishing
29+
contents: write # IMPORTANT: mandatory for making GitHub Releases
30+
31+
steps:
32+
- name: Checkout
33+
uses: actions/checkout@v4
34+
with:
35+
fetch-depth: 0
36+
37+
- name: Python Semantic Release
38+
id: release
39+
uses: python-semantic-release/python-semantic-release@master
40+
with:
41+
github_token: ${{ secrets.GITHUB_TOKEN }}
42+
changelog: true
43+
44+
# https://docs.pypi.org/trusted-publishers/using-a-publisher/
45+
- name: Publish package distributions to PyPI
46+
if: steps.release.outputs.released == 'true'
47+
uses: pypa/gh-action-pypi-publish@release/v1
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Semantic release dry run
2+
3+
on: workflow_dispatch
4+
5+
jobs:
6+
semantic-release-dry-run:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Checkout
10+
uses: actions/checkout@v4
11+
with:
12+
ref: ${{ github.head_ref || github.ref_name }}
13+
fetch-depth: 0
14+
15+
- name: Python Semantic Release (Dry Run)
16+
id: release
17+
uses: python-semantic-release/python-semantic-release@master
18+
with:
19+
github_token: ${{ secrets.GITHUB_TOKEN }}
20+
no_operation_mode: true
21+
changelog: true
22+
23+
- name: Echo changelog contents
24+
run: cat CHANGELOG.md
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Test and Merge
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
pre-commit:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- uses: actions/setup-python@v5
16+
with:
17+
python-version: "3.10"
18+
19+
# Install and run pre-commit
20+
- run: |
21+
pip install pre-commit
22+
pre-commit install
23+
pre-commit run --all-files
24+
25+
pytest:
26+
if: false # Test running currently deactivated as it requires slicer lib wheel generation for each target
27+
name: Pytest ${{ matrix.config.name }}
28+
runs-on: ${{ matrix.config.os }}
29+
strategy:
30+
fail-fast: false
31+
matrix:
32+
python-version: ["3.10", "3.13"]
33+
config:
34+
- { name: "Linux", os: ubuntu-latest }
35+
- { name: "MacOSX", os: macos-latest }
36+
- { name: "Windows", os: windows-latest }
37+
38+
defaults:
39+
run:
40+
shell: bash
41+
42+
steps:
43+
- name: Checkout
44+
uses: actions/checkout@v4
45+
46+
- name: Set up Python ${{ matrix.python-version }}
47+
uses: actions/setup-python@v5
48+
with:
49+
python-version: ${{ matrix.python-version }}
50+
51+
- name: Install and Run Tests
52+
run: |
53+
pip install .[dev]
54+
pytest -s ./tests

.github/workflows/test_and_release.yml

Lines changed: 0 additions & 109 deletions
This file was deleted.

0 commit comments

Comments
 (0)