Skip to content

Commit e03d0a8

Browse files
radoeringbranchv
authored andcommitted
ci: update release workflow and use hashes for actions
1 parent 94d3b7f commit e03d0a8

File tree

2 files changed

+47
-36
lines changed

2 files changed

+47
-36
lines changed

.github/workflows/main.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,13 @@ jobs:
3030
run:
3131
shell: bash
3232
steps:
33-
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
33+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
3434

3535
- name: Set up Python ${{ matrix.python-version }}
36-
uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1
36+
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
3737
with:
3838
python-version: ${{ matrix.python-version }}
39+
allow-prereleases: true
3940

4041
- name: Get full Python version
4142
id: full-python-version
@@ -57,7 +58,7 @@ jobs:
5758
run: poetry config virtualenvs.in-project true
5859

5960
- name: Set up cache
60-
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
61+
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
6162
id: cache
6263
with:
6364
path: .venv

.github/workflows/release.yaml

Lines changed: 43 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,58 @@
11
name: Release
22

33
on:
4-
push:
5-
tags:
6-
- "*.*.*"
4+
release:
5+
types: [published]
76

87
jobs:
9-
release:
10-
name: Release
8+
build:
9+
name: Build
1110
runs-on: ubuntu-latest
1211
steps:
13-
- name: Checkout code
14-
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
12+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1513

16-
- name: Set up Python 3.10
17-
uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1
18-
with:
19-
python-version: "3.10"
14+
- run: pipx run build
2015

21-
- name: Install Poetry
22-
run: |
23-
curl -sSL https://install.python-poetry.org | python - -y
16+
- uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
17+
with:
18+
name: distfiles
19+
path: dist/
20+
if-no-files-found: error
2421

25-
- name: Update PATH
26-
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
22+
upload-github:
23+
name: Upload (GitHub)
24+
runs-on: ubuntu-latest
25+
permissions:
26+
contents: write
27+
needs: build
28+
steps:
29+
# We need to be in a git repo for gh to work.
30+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2731

28-
- name: Build project for distribution
29-
run: poetry build
32+
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
33+
with:
34+
name: distfiles
35+
path: dist/
3036

31-
- name: Check Version
32-
id: check-version
33-
run: |
34-
[[ "$(poetry version --short)" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] \
35-
|| echo prerelease=true >> $GITHUB_OUTPUT
37+
- run: gh release upload ${{ github.event.release.tag_name }} dist/*.{tar.gz,whl}
38+
env:
39+
GH_TOKEN: ${{ github.token }}
3640

37-
- name: Create Release
38-
uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5 # v1.14.0
41+
upload-pypi:
42+
name: Upload (PyPI)
43+
runs-on: ubuntu-latest
44+
environment:
45+
name: pypi
46+
url: https://pypi.org/project/poetry-plugin-bundle/
47+
permissions:
48+
id-token: write
49+
needs: build
50+
steps:
51+
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
3952
with:
40-
artifacts: "dist/*"
41-
token: ${{ secrets.GITHUB_TOKEN }}
42-
draft: false
43-
prerelease: steps.check-version.outputs.prerelease == 'true'
53+
name: distfiles
54+
path: dist/
4455

45-
- name: Publish to PyPI
46-
env:
47-
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
48-
run: poetry publish
56+
- uses: pypa/gh-action-pypi-publish@15c56dba361d8335944d31a2ecd17d700fc7bcbc # v1.12.2
57+
with:
58+
print-hash: true

0 commit comments

Comments
 (0)