Skip to content

Commit ed3a06b

Browse files
committed
feat: big ci improvements
- Call the build workflow from the release workflow beofre release is created - call the update-homebrew workflow in the homebrew-tap repo using respository_dispatch - cleanup files for release
1 parent 94fa097 commit ed3a06b

File tree

10 files changed

+104
-462
lines changed

10 files changed

+104
-462
lines changed

.github/workflows/build.yml

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
name: Build Binaries
22

33
on:
4+
workflow_call:
5+
inputs:
6+
version:
7+
type: string
8+
required: false
9+
default: ''
410
push:
511
branches:
612
- main
7-
tags:
8-
- v*
913
pull_request:
1014
branches:
1115
- main
@@ -20,16 +24,12 @@ jobs:
2024
include:
2125
- runner: ubuntu22-4cpu-amd64
2226
platform: linux-amd64
23-
arch: x64
2427
- runner: ubuntu22-4cpu-arm64
2528
platform: linux-arm64
26-
arch: aarch64
2729
- runner: macos-latest
2830
platform: macos-arm64
29-
arch: arm64
3031
- runner: windows-latest
3132
platform: windows
32-
arch: x64
3333

3434
steps:
3535
- name: Checkout code
@@ -59,20 +59,12 @@ jobs:
5959
else
6060
mv ./dist/__main__/__main__ ./dist/__main__/lumos
6161
fi
62-
tar -czf lumos-${{ matrix.platform }}.tar.gz -C ./dist/__main__ .
62+
VERSION="${{ inputs.version || 'dev' }}"
63+
tar -czf lumos-${{ matrix.platform }}-${VERSION}.tar.gz -C ./dist/__main__ .
6364

6465
- name: Upload artifacts to workflow
6566
uses: actions/upload-artifact@v4
6667
with:
67-
name: lumos-${{ matrix.platform }}
68-
path: lumos-${{ matrix.platform }}.tar.gz
69-
retention-days: 90
70-
71-
- name: Upload artifacts to release
72-
if: startsWith(github.ref, 'refs/tags/')
73-
env:
74-
GH_TOKEN: ${{ github.token }}
75-
run: |
76-
gh release upload ${{ github.ref_name }} lumos-${{ matrix.platform }}.tar.gz
77-
<<<<<<< HEAD
78-
=======
68+
name: lumos-${{ matrix.platform }}-${{ inputs.version || 'dev' }}
69+
path: lumos-${{ matrix.platform }}-${{ inputs.version || 'dev' }}.tar.gz
70+
retention-days: 90

.github/workflows/release.yml

Lines changed: 83 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
name: Release
2+
23
on:
34
workflow_dispatch:
45
inputs:
@@ -8,14 +9,60 @@ on:
89
default: "false"
910

1011
jobs:
12+
prepare:
13+
name: Prepare Release
14+
runs-on: ubuntu-latest
15+
outputs:
16+
new-release-version: ${{ steps.semantic.outputs.new-release-version }}
17+
steps:
18+
- uses: actions/create-github-app-token@v2
19+
id: app-token
20+
with:
21+
app-id: ${{ secrets.GH_BOT_CLIENT_ID }}
22+
private-key: ${{ secrets.GH_BOT_PRIVATE_KEY }}
23+
24+
- uses: actions/checkout@v4
25+
with:
26+
token: ${{ steps.app-token.outputs.token }}
27+
fetch-depth: 0
28+
29+
- name: Setup Node.js
30+
uses: actions/setup-node@v3
31+
with:
32+
node-version: "lts/*"
33+
34+
- name: Install Modules
35+
run: |
36+
npm install \
37+
@semantic-release/git \
38+
@semantic-release/changelog \
39+
@semantic-release/exec
40+
41+
- name: Determine next version
42+
id: semantic
43+
env:
44+
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
45+
run: npx semantic-release --dry-run
46+
47+
48+
build:
49+
name: Build
50+
needs: prepare
51+
if: needs.prepare.outputs.new-release-version != ''
52+
uses: ./.github/workflows/build.yml
53+
with:
54+
version: v${{ needs.prepare.outputs.new-release-version }}
55+
secrets: inherit
56+
1157
release:
12-
name: Release
58+
name: Create Release
59+
needs: [prepare, build]
60+
if: inputs.dry-run != 'true'
1361
runs-on: ubuntu-latest
1462
steps:
1563
- uses: actions/create-github-app-token@v2
1664
id: app-token
1765
with:
18-
# required
1966
app-id: ${{ secrets.GH_BOT_CLIENT_ID }}
2067
private-key: ${{ secrets.GH_BOT_PRIVATE_KEY }}
2168

@@ -29,7 +76,7 @@ jobs:
2976
- uses: actions/checkout@v4
3077
with:
3178
token: ${{ steps.app-token.outputs.token }}
32-
persist-credentials: false
79+
fetch-depth: 0
3380

3481
- name: Setup Node.js
3582
uses: actions/setup-node@v3
@@ -41,14 +88,41 @@ jobs:
4188
npm install \
4289
@semantic-release/git \
4390
@semantic-release/changelog \
44-
@semantic-release/exec \
45-
@semantic-release/github \
46-
@semantic-release/commit-analyzer \
47-
@semantic-release/release-notes-generator
91+
@semantic-release/exec
92+
93+
- name: Download all build artifacts
94+
uses: actions/download-artifact@v4
95+
with:
96+
pattern: lumos-*-v${{ needs.prepare.outputs.new-release-version }}
97+
merge-multiple: true
98+
99+
- name: List downloaded artifacts
100+
run: ls -la lumos-*.tar.gz
48101

49-
- name: Release
102+
- name: Create Release
50103
env:
51104
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
52105
GIT_AUTHOR_EMAIL: "${{ steps.bot-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com"
53106
GIT_COMMITTER_EMAIL: "${{ steps.bot-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com"
54-
run: npx semantic-release --dry-run=${{ inputs.dry-run }}
107+
run: npx semantic-release
108+
109+
release-homebrew:
110+
name: Release Homebrew Tap
111+
needs: [prepare, release]
112+
if: inputs.dry-run != 'true'
113+
runs-on: ubuntu-latest
114+
steps:
115+
- uses: actions/create-github-app-token@v2
116+
id: app-token
117+
with:
118+
app-id: ${{ secrets.GH_BOT_CLIENT_ID }}
119+
private-key: ${{ secrets.GH_BOT_PRIVATE_KEY }}
120+
repositories: homebrew-tap
121+
122+
- name: Trigger homebrew-tap release
123+
run: |
124+
curl -X POST \
125+
-H "Authorization: token ${{ steps.app-token.outputs.token }}" \
126+
-H "Accept: application/vnd.github+json" \
127+
https://api.github.com/repos/teamlumos/homebrew-tap/dispatches \
128+
-d '{"event_type": "release", "client_payload": {"version": "v${{ needs.prepare.outputs.new-release-version }}"}}'

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ venv/
33
.venv/
44
*.pyc
55
*/__pycache__/
6+
.mypy_cache/
67
*.spec
78
/build/
89
/dist/

.releaserc.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ plugins:
1313
- "@semantic-release/changelog"
1414

1515
- - "@semantic-release/exec"
16+
- verifyReleaseCmd: echo "new-release-version=${nextRelease.version}" >> $GITHUB_OUTPUT
1617
- prepareCommand: uv version ${nextRelease.version}
1718

1819
- - "@semantic-release/git"
@@ -21,4 +22,6 @@ plugins:
2122
- CHANGELOG.md
2223
- pyproject.toml
2324

24-
- "@semantic-release/github"
25+
- - "@semantic-release/github"
26+
- assets:
27+
- path: "lumos-*.tar.gz"

IMPLEMENTATION_SUMMARY.md

Lines changed: 0 additions & 116 deletions
This file was deleted.

QUICK_START.md

Lines changed: 0 additions & 69 deletions
This file was deleted.

0 commit comments

Comments
 (0)