Skip to content

Commit fdd5810

Browse files
authored
Merge pull request #2 from febus982/split-release-workflow
Split build and release jobs
2 parents 4be9e7b + af0319f commit fdd5810

1 file changed

Lines changed: 47 additions & 28 deletions

File tree

.github/workflows/release.yml

Lines changed: 47 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,37 +4,56 @@ name: release
44

55
on:
66
release:
7-
types: [published]
8-
9-
permissions:
10-
# This permission is required for trusted publishing.
11-
id-token: write
12-
contents: read
7+
types: [ published ]
138

149
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: read
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v3
17+
18+
- name: Set up Python 3.12
19+
uses: actions/setup-python@v4
20+
with:
21+
python-version: "3.12"
22+
23+
- name: Install dependencies
24+
run: |
25+
python -m pip install --upgrade pip
26+
python -m pip install poetry poetry-dynamic-versioning
27+
28+
- name: Build package
29+
run: |
30+
poetry build
31+
32+
- name: Archive the dist folder
33+
uses: actions/upload-artifact@v3
34+
with:
35+
name: dist
36+
path: dist
37+
retention-days: 1
38+
1539
publish:
1640
runs-on: ubuntu-latest
41+
needs: build
42+
permissions:
43+
id-token: write
1744

1845
steps:
19-
- uses: actions/checkout@v3
20-
- name: Set up Python 3.12
21-
uses: actions/setup-python@v4
22-
with:
23-
python-version: "3.12"
24-
- name: Install dependencies
25-
run: |
26-
python -m pip install --upgrade pip
27-
python -m pip install poetry poetry-dynamic-versioning
28-
29-
- name: Build package
30-
run: |
31-
poetry build
32-
33-
- name: Publish package distributions to TestPyPI
34-
uses: pypa/gh-action-pypi-publish@release/v1
35-
################################
36-
# REMOVE CUSTOM REPOSITORY TO #
37-
# PUBLISH ON OFFICIAL PYPI #
38-
################################
39-
with:
40-
repository-url: https://test.pypi.org/legacy/
46+
- name: Download the dist folder from the build job
47+
uses: actions/download-artifact@v3
48+
with:
49+
name: dist
50+
path: dist
51+
52+
- name: Publish package distributions to TestPyPI
53+
uses: pypa/gh-action-pypi-publish@release/v1
54+
################################
55+
# REMOVE CUSTOM REPOSITORY TO #
56+
# PUBLISH ON OFFICIAL PYPI #
57+
################################
58+
with:
59+
repository-url: https://test.pypi.org/legacy/

0 commit comments

Comments
 (0)