Skip to content
This repository was archived by the owner on Dec 16, 2025. It is now read-only.

Commit bc8a407

Browse files
Add support to create pre-releases and releases automatically
Signed-off-by: Tobias Wolf <[email protected]>
1 parent 49641ad commit bc8a407

File tree

2 files changed

+99
-0
lines changed

2 files changed

+99
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: py:pre-release
2+
3+
on:
4+
push:
5+
tags: [ 'v*' ]
6+
7+
jobs:
8+
create-pre-release:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout commit
13+
uses: actions/checkout@v3
14+
- name: Get the Git tag name
15+
id: get-tag-name
16+
run: echo "tag-name=${GITHUB_REF/refs\/tags\/v/}"
17+
- name: Create Release
18+
uses: actions/create-release@v2
19+
env:
20+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
21+
with:
22+
tag_name: v${{ steps.get-tag-name.outputs.tag-name }}
23+
release_name: v${{ steps.get-tag-name.outputs.tag-name }}
24+
body: |-
25+
"Rookify" release v${{ steps.get-tag-name.outputs.tag-name }}
26+
prerelease: true
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: py:publish
2+
3+
on:
4+
release:
5+
types: [ released ]
6+
7+
jobs:
8+
ghcr-publish:
9+
runs-on: ubuntu-latest
10+
env:
11+
REGISTRY: ghcr.io
12+
IMAGE_NAME: ${{ github.repository }}
13+
permissions:
14+
attestations: write
15+
contents: read
16+
id-token: write
17+
packages: write
18+
19+
steps:
20+
- name: Checkout commit
21+
uses: actions/checkout@v3
22+
- name: Log in to ghcr.io
23+
uses: docker/login-action@v3
24+
with:
25+
registry: ${{ env.REGISTRY }}
26+
username: ${{ github.actor }}
27+
password: ${{ secrets.GITHUB_TOKEN }}
28+
- name: Extract metadata
29+
id: metadata
30+
uses: docker/metadata-action@v5
31+
with:
32+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
33+
- name: Build and push
34+
id: push
35+
uses: docker/build-push-action@v6
36+
with:
37+
context: .
38+
push: true
39+
tags: ${{ steps.metadata.outputs.tags }}
40+
labels: ${{ steps.metadata.outputs.labels }}
41+
- name: Generate artifact attestation
42+
uses: actions/attest-build-provenance@v1
43+
with:
44+
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
45+
subject-digest: ${{ steps.push.outputs.digest }}
46+
push-to-registry: true
47+
48+
pypi-publish:
49+
runs-on: ubuntu-latest
50+
environment:
51+
name: pypi
52+
url: https://pypi.org/p/rookify
53+
permissions:
54+
id-token: write
55+
56+
steps:
57+
- name: Checkout commit
58+
uses: actions/checkout@v3
59+
- name: Set up Python
60+
id: setup-python
61+
uses: actions/setup-python@v3
62+
- name: Install dependencies
63+
run: |-
64+
pip install -r ./requirements.txt
65+
pip install build
66+
- name: Execute build
67+
run: |-
68+
python -m build .
69+
- name: Publish package
70+
uses: pypa/gh-action-pypi-publish@v1
71+
with:
72+
user: __token__
73+
password: ${{ secrets.PYPI_PROD_PASSWORD }}

0 commit comments

Comments
 (0)