Skip to content

Commit ed88776

Browse files
author
Théo LAGACHE
committed
chore(release): 26.01.1b18
1 parent 19b6dc7 commit ed88776

7 files changed

Lines changed: 340 additions & 147 deletions

File tree

.github/workflows/github.yml

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
name: GitHub Release
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
artifact_name:
7+
required: false
8+
type: string
9+
default: ""
10+
prerelease:
11+
required: false
12+
type: boolean
13+
default: false
14+
make_latest:
15+
required: false
16+
type: boolean
17+
default: false
18+
discord_title:
19+
required: true
20+
type: string
21+
discord_color:
22+
required: true
23+
type: number
24+
discord_footer:
25+
required: true
26+
type: string
27+
secrets:
28+
DISCORD_WEBHOOK:
29+
required: true
30+
GH_TOKEN:
31+
required: true
32+
33+
jobs:
34+
create-release:
35+
runs-on: ubuntu-latest
36+
permissions:
37+
contents: write
38+
steps:
39+
- name: Check out the repo
40+
uses: actions/checkout@v4
41+
with:
42+
fetch-depth: 0
43+
44+
- name: Download artifacts
45+
if: inputs.artifact_name != ''
46+
uses: actions/download-artifact@v4
47+
with:
48+
pattern: ${{ inputs.artifact_name }}
49+
path: dist
50+
merge-multiple: true
51+
52+
- name: Generate Checksums
53+
if: inputs.artifact_name != ''
54+
working-directory: dist
55+
run: |
56+
sha256sum * > checksums.txt
57+
58+
- name: Build Changelog
59+
id: build_changelog
60+
uses: mikepenz/release-changelog-builder-action@v5
61+
with:
62+
mode: "COMMIT"
63+
configurationJson: |
64+
{
65+
"template": "#{{CHANGELOG}}",
66+
"categories": [
67+
{
68+
"title": "## Feature",
69+
"labels": ["feat", "feature"]
70+
},
71+
{
72+
"title": "## Fix",
73+
"labels": ["fix", "bug"]
74+
},
75+
{
76+
"title": "## Other",
77+
"labels": []
78+
}
79+
],
80+
"label_extractor": [
81+
{
82+
"pattern": "^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test){1}(\([\w\-\.]+\))?(!)?: ([\w ])+([\s\S]*)",
83+
"on_property": "title",
84+
"target": "$1"
85+
}
86+
]
87+
}
88+
env:
89+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
90+
91+
- name: Create GitHub Release
92+
uses: softprops/action-gh-release@v2
93+
with:
94+
files: dist/*
95+
generate_release_notes: false
96+
body: ${{ steps.build_changelog.outputs.changelog }}
97+
prerelease: ${{ inputs.prerelease }}
98+
make_latest: ${{ inputs.make_latest }}
99+
env:
100+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
101+
102+
- name: Send Discord Notification
103+
env:
104+
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
105+
GH_TOKEN: ${{ secrets.GH_TOKEN }}
106+
run: |
107+
RELEASE_INFO=$(gh release view "${{ github.ref_name }}" -R ${{ github.repository }} --json name,url,body,author)
108+
109+
RELEASE_TITLE=$(echo "$RELEASE_INFO" | jq -r .name)
110+
if [ -z "$RELEASE_TITLE" ] || [ "$RELEASE_TITLE" = "null" ]; then RELEASE_TITLE="${{ github.ref_name }}"; fi
111+
112+
RELEASE_URL=$(echo "$RELEASE_INFO" | jq -r .url)
113+
RELEASE_BODY=$(echo "$RELEASE_INFO" | jq -r .body)
114+
115+
AUTHOR_NAME="Portabase"
116+
AUTHOR_ICON="https://github.com/Portabase.png"
117+
118+
PAYLOAD=$(jq -n \
119+
--arg title "$RELEASE_TITLE" \
120+
--arg description "$RELEASE_BODY" \
121+
--arg url "$RELEASE_URL" \
122+
--arg author "$AUTHOR_NAME" \
123+
--arg icon "$AUTHOR_ICON" \
124+
--arg discord_title "${{ inputs.discord_title }}" \
125+
--arg discord_footer "${{ inputs.discord_footer }}" \
126+
--argjson discord_color ${{ inputs.discord_color }} \
127+
'{
128+
content: $discord_title,
129+
embeds: [{
130+
title: $title,
131+
url: $url,
132+
description: $description,
133+
color: $discord_color,
134+
author: {
135+
name: $author,
136+
icon_url: $icon
137+
},
138+
footer: {
139+
text: $discord_footer
140+
}
141+
}]
142+
}'
143+
)
144+
145+
curl -H "Content-Type: application/json" \
146+
-d "$PAYLOAD" \
147+
"$DISCORD_WEBHOOK"

.github/workflows/python.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Build Python Binaries
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
build:
8+
name: Build for ${{ matrix.os }} (${{ matrix.arch }})
9+
runs-on: ${{ matrix.runner }}
10+
strategy:
11+
matrix:
12+
include:
13+
- os: linux
14+
arch: amd64
15+
runner: ubuntu-latest
16+
- os: macos
17+
arch: arm64
18+
runner: macos-latest
19+
- os: macos
20+
arch: amd64
21+
runner: macos-15
22+
23+
steps:
24+
- uses: actions/checkout@v4
25+
26+
- name: Install uv
27+
uses: astral-sh/setup-uv@v3
28+
29+
- name: Set up Python
30+
run: uv python install
31+
32+
- name: Build binary
33+
run: |
34+
uv run pyinstaller --onefile --name portabase_${{ matrix.os }}_${{ matrix.arch }} --paths=. --add-data "pyproject.toml:." main.py
35+
36+
- name: Upload artifacts
37+
uses: actions/upload-artifact@v4
38+
with:
39+
name: portabase_${{ matrix.os }}_${{ matrix.arch }}
40+
path: dist/portabase_${{ matrix.os }}_${{ matrix.arch }}
41+
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Publish Python binaries for release candidate
2+
3+
on:
4+
push:
5+
tags:
6+
- '*.*.*a*'
7+
- '*.*.*b*'
8+
- '*.*.*rc*'
9+
10+
permissions:
11+
contents: write
12+
packages: write
13+
14+
jobs:
15+
python_build:
16+
uses: ./.github/workflows/python.yml
17+
18+
github_release:
19+
needs: python_build
20+
uses: ./.github/workflows/github.yml
21+
with:
22+
artifact_name: "portabase_*"
23+
prerelease: true
24+
make_latest: false
25+
discord_title: "||@release-cli|| New release candidate published"
26+
discord_color: 16776960
27+
discord_footer: "Portabase"
28+
secrets:
29+
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
30+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release.yml

Lines changed: 23 additions & 144 deletions
Original file line numberDiff line numberDiff line change
@@ -1,153 +1,32 @@
1-
name: Release
1+
name: Publish Python binaries for release
22

33
on:
44
push:
55
tags:
6-
- 'v*'
6+
- '*.*.*'
7+
- '!*-*'
8+
- '!*.*.*a*'
9+
- '!*.*.*b*'
10+
- '!*.*.*rc*'
711

812
permissions:
913
contents: write
14+
packages: write
1015

1116
jobs:
12-
build:
13-
name: Build for ${{ matrix.os }} (${{ matrix.arch }})
14-
runs-on: ${{ matrix.runner }}
15-
strategy:
16-
matrix:
17-
include:
18-
- os: linux
19-
arch: amd64
20-
runner: ubuntu-latest
21-
- os: macos
22-
arch: arm64
23-
runner: macos-latest
24-
- os: macos
25-
arch: amd64
26-
runner: macos-15
27-
28-
steps:
29-
- uses: actions/checkout@v4
30-
31-
- name: Install uv
32-
uses: astral-sh/setup-uv@v3
33-
34-
- name: Set up Python
35-
run: uv python install
36-
37-
- name: Inject Version
38-
shell: bash
39-
run: |
40-
VERSION="${{ github.ref_name }}"
41-
export VERSION="${VERSION#v}"
42-
python -c "import os, re; v = os.environ['VERSION']; p = 'pyproject.toml'; c = open(p).read(); c = re.sub(r'version = \".*\"', f'version = \"{v}\"', c); open(p, 'w').write(c)"
43-
44-
- name: Build binary
45-
run: |
46-
uv run pyinstaller --onefile --name portabase_${{ matrix.os }}_${{ matrix.arch }} --paths=. --add-data "pyproject.toml:." main.py
47-
48-
- name: Upload artifacts
49-
uses: actions/upload-artifact@v4
50-
with:
51-
name: portabase_${{ matrix.os }}_${{ matrix.arch }}
52-
path: dist/portabase_${{ matrix.os }}_${{ matrix.arch }}
53-
54-
release:
55-
needs: build
56-
runs-on: ubuntu-latest
57-
steps:
58-
- name: Download all artifacts
59-
uses: actions/download-artifact@v4
60-
with:
61-
path: ./dist
62-
pattern: portabase_*
63-
merge-multiple: true
64-
- name: Generate Checksums
65-
working-directory: ./dist
66-
run: |
67-
sha256sum portabase_* > checksums.txt
68-
- name: Build Changelog
69-
id: build_changelog
70-
uses: mikepenz/release-changelog-builder-action@v5
71-
with:
72-
mode: "COMMIT"
73-
configurationJson: |
74-
{
75-
"template": "#{{CHANGELOG}}",
76-
"categories": [
77-
{
78-
"title": "## Feature",
79-
"labels": ["feat", "feature"]
80-
},
81-
{
82-
"title": "## Fix",
83-
"labels": ["fix", "bug"]
84-
},
85-
{
86-
"title": "## Other",
87-
"labels": []
88-
}
89-
],
90-
"label_extractor": [
91-
{
92-
"pattern": "^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test){1}(\\([\\w\\-\\.]+\\))?(!)?: ([\\w ])+([\\s\\S]*)",
93-
"on_property": "title",
94-
"target": "$1"
95-
}
96-
]
97-
}
98-
env:
99-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
100-
101-
- name: Create GitHub Release
102-
uses: softprops/action-gh-release@v2
103-
with:
104-
files: dist/*
105-
generate_release_notes: false
106-
body: ${{ steps.build_changelog.outputs.changelog }}
107-
make_latest: true
108-
env:
109-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
110-
111-
- name: Send Discord Notification
112-
env:
113-
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
114-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
115-
run: |
116-
RELEASE_INFO=$(gh release view "${{ github.ref_name }}" -R ${{ github.repository }} --json name,url,body,author)
117-
118-
RELEASE_TITLE=$(echo "$RELEASE_INFO" | jq -r .name)
119-
if [ -z "$RELEASE_TITLE" ] || [ "$RELEASE_TITLE" = "null" ]; then RELEASE_TITLE="${{ github.ref_name }}"; fi
120-
121-
RELEASE_URL=$(echo "$RELEASE_INFO" | jq -r .url)
122-
RELEASE_BODY=$(echo "$RELEASE_INFO" | jq -r .body)
123-
124-
AUTHOR_NAME="Portabase"
125-
AUTHOR_ICON="https://github.com/Portabase.png"
126-
127-
PAYLOAD=$(jq -n \
128-
--arg title "$RELEASE_TITLE" \
129-
--arg description "$RELEASE_BODY" \
130-
--arg url "$RELEASE_URL" \
131-
--arg author "$AUTHOR_NAME" \
132-
--arg icon "$AUTHOR_ICON" \
133-
'{
134-
content: "||@everyone|| New release published",
135-
embeds: [{
136-
title: $title,
137-
url: $url,
138-
description: $description,
139-
color: 5814783,
140-
author: {
141-
name: $author,
142-
icon_url: $icon
143-
},
144-
footer: {
145-
text: "Portabase"
146-
}
147-
}]
148-
}'
149-
)
150-
151-
curl -H "Content-Type: application/json" \
152-
-d "$PAYLOAD" \
153-
"$DISCORD_WEBHOOK"
17+
python_build:
18+
uses: ./.github/workflows/python.yml
19+
20+
github_release:
21+
needs: python_build
22+
uses: ./.github/workflows/github.yml
23+
with:
24+
artifact_name: "portabase_*"
25+
prerelease: false
26+
make_latest: true
27+
discord_title: "||@release-cli|| New release published"
28+
discord_color: 5814783
29+
discord_footer: "Portabase"
30+
secrets:
31+
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
32+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)