Skip to content

Commit 8b26666

Browse files
committed
feat(ci): separate release-to-homebrew from the deploy pipeline
- this allows easier re-runs on errors - will be triggered after a github release is created - behaves now just like building the release binaries Signed-off-by: Sven Kanoldt <sven@d34dl0ck.me>
1 parent b75683c commit 8b26666

File tree

2 files changed

+57
-44
lines changed

2 files changed

+57
-44
lines changed

.github/workflows/deploy.yml

Lines changed: 5 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ on:
1313
description: "Version"
1414
required: true
1515
default: "0.1.0"
16-
do-homebrew:
16+
do-cargo-release:
1717
type: boolean
18-
description: "Publish to Homebrew"
19-
required: false
18+
description: "Publish to crates.io"
19+
required: true
2020
default: true
2121
do-github-release:
2222
type: boolean
2323
description: "Create a GitHub release"
24-
required: false
24+
required: true
2525
default: true
2626

2727
jobs:
@@ -30,7 +30,7 @@ jobs:
3030
uses: sassman/t-rec-rs/.github/workflows/build.yml@main
3131

3232
publish:
33-
if: github.event_name == 'push' && contains(github.event.ref, 'refs/tags/v')
33+
if: github.event_name == 'push' && contains(github.event.ref, 'refs/tags/v') || (github.event_name == 'workflow_dispatch' && ${{ github.event.inputs.do-cargo-release }})
3434
name: post / cargo publish
3535
needs: [doing-a-build]
3636
runs-on: macos-latest
@@ -46,45 +46,6 @@ jobs:
4646
with:
4747
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
4848

49-
# https://github.com/mislav/bump-homebrew-formula-action
50-
publish-to-brew:
51-
name: post / homebrew
52-
needs: [doing-a-build]
53-
runs-on: macos-latest
54-
if: (github.event_name == 'push' && contains(github.event.ref, 'refs/tags/v')) || (github.event_name == 'workflow_dispatch' && ${{ github.event.inputs.do-homebrew }})
55-
steps:
56-
- uses: actions/create-github-app-token@v1
57-
id: app-token
58-
with:
59-
app-id: 1178949
60-
private-key: ${{ secrets.PRIVATE_KEY_5422M4N_BOT }}
61-
62-
- name: Get GitHub App User ID
63-
id: get-user-id
64-
run: echo "user-id=$(gh api "/users/${{ steps.app-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT"
65-
env:
66-
GH_TOKEN: ${{ steps.app-token.outputs.token }}
67-
- run: |
68-
git config --global user.name '${{ steps.app-token.outputs.app-slug }}[bot]'
69-
git config --global user.email '${{ steps.get-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com'
70-
71-
- name: Get version from tag
72-
if: github.event_name == 'push' && contains(github.event.ref, 'refs/tags/v')
73-
run: echo RELEASE_VERSION=${GITHUB_REF#refs/tags/v} >> $GITHUB_ENV
74-
shell: bash
75-
- name: Get version from input
76-
if: github.event_name == 'workflow_dispatch'
77-
run: echo RELEASE_VERSION=${{ github.event.inputs.version }} >> $GITHUB_ENV
78-
shell: bash
79-
- uses: mislav/bump-homebrew-formula-action@v3
80-
with:
81-
formula-name: t-rec
82-
tag-name: v${{ env.RELEASE_VERSION }}
83-
version: ${{ env.RELEASE_VERSION }}
84-
85-
env:
86-
COMMITTER_TOKEN: ${{ steps.app-token.outputs.token }}
87-
8849
release:
8950
name: post / github release
9051
needs: [doing-a-build]
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Release Binary Assets
2+
on:
3+
release:
4+
types:
5+
- published
6+
workflow_dispatch:
7+
inputs:
8+
version:
9+
type: string
10+
description: "Version"
11+
required: true
12+
default: "0.1.0"
13+
14+
jobs:
15+
# https://github.com/mislav/bump-homebrew-formula-action
16+
publish-to-brew:
17+
name: post / homebrew
18+
needs: [doing-a-build]
19+
runs-on: macos-latest
20+
if: (github.event_name == 'push' && contains(github.event.ref, 'refs/tags/v')) || (github.event_name == 'workflow_dispatch' && ${{ github.event.inputs.do-homebrew }})
21+
steps:
22+
- uses: actions/create-github-app-token@v1
23+
id: app-token
24+
with:
25+
app-id: 1178949
26+
private-key: ${{ secrets.PRIVATE_KEY_5422M4N_BOT }}
27+
28+
- name: Get GitHub App User ID
29+
id: get-user-id
30+
run: echo "user-id=$(gh api "/users/${{ steps.app-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT"
31+
env:
32+
GH_TOKEN: ${{ steps.app-token.outputs.token }}
33+
- run: |
34+
git config --global user.name '${{ steps.app-token.outputs.app-slug }}[bot]'
35+
git config --global user.email '${{ steps.get-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com'
36+
37+
- name: Get version from tag
38+
if: github.event_name == 'push' && contains(github.event.ref, 'refs/tags/v')
39+
run: echo RELEASE_VERSION=${GITHUB_REF#refs/tags/v} >> $GITHUB_ENV
40+
shell: bash
41+
- name: Get version from input
42+
if: github.event_name == 'workflow_dispatch'
43+
run: echo RELEASE_VERSION=${{ github.event.inputs.version }} >> $GITHUB_ENV
44+
shell: bash
45+
- uses: mislav/bump-homebrew-formula-action@v3
46+
with:
47+
formula-name: t-rec
48+
tag-name: v${{ env.RELEASE_VERSION }}
49+
version: ${{ env.RELEASE_VERSION }}
50+
51+
env:
52+
COMMITTER_TOKEN: ${{ steps.app-token.outputs.token }}

0 commit comments

Comments
 (0)