Skip to content

Commit 9514d19

Browse files
authored
fix: set up test release workflow (#2)
1 parent 3667371 commit 9514d19

File tree

1 file changed

+28
-9
lines changed

1 file changed

+28
-9
lines changed

.github/workflows/ci.yml

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -61,19 +61,15 @@ jobs:
6161
with:
6262
token: ${{ secrets.CODECOV_TOKEN }}
6363

64-
release:
64+
test_release:
6565
needs:
6666
- test
6767
- lint
6868
- commitlint
6969

7070
runs-on: ubuntu-latest
71-
environment: release
72-
concurrency: release
73-
permissions:
74-
id-token: write
75-
attestations: write
76-
contents: write
71+
environment: test_release
72+
if: github.ref_name != 'main'
7773

7874
steps:
7975
- uses: actions/checkout@v4
@@ -88,16 +84,39 @@ jobs:
8884
# Do a dry run of PSR
8985
- name: Test release
9086
uses: python-semantic-release/python-semantic-release@v9
91-
if: github.ref_name != 'main'
9287
with:
9388
root_options: --noop
9489
github_token: noop
9590

91+
release:
92+
needs:
93+
- test
94+
- lint
95+
- commitlint
96+
97+
if: github.ref_name == 'main'
98+
runs-on: ubuntu-latest
99+
environment: release
100+
concurrency: release
101+
permissions:
102+
id-token: write
103+
attestations: write
104+
contents: write
105+
106+
steps:
107+
- uses: actions/checkout@v4
108+
with:
109+
fetch-depth: 0
110+
ref: ${{ github.sha }}
111+
112+
- name: Checkout commit for release
113+
run: |
114+
git checkout -B ${{ github.ref_name }} ${{ github.sha }}
115+
96116
# On main branch: actual PSR + upload to PyPI & GitHub
97117
- name: Release
98118
uses: python-semantic-release/python-semantic-release@v9
99119
id: release
100-
if: github.ref_name == 'main'
101120
with:
102121
github_token: ${{ secrets.GITHUB_TOKEN }}
103122

0 commit comments

Comments
 (0)