-
Notifications
You must be signed in to change notification settings - Fork 0
104 lines (89 loc) · 3.29 KB
/
Copy pathrelease.yml
File metadata and controls
104 lines (89 loc) · 3.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
name: Release
on:
push:
branches: ["main"]
concurrency:
group: release
cancel-in-progress: false
permissions:
actions: write
contents: write
pull-requests: write
env:
TAG_PREFIX: wallhack-cli-v
VERSION_FILE: crates/cli/Cargo.toml
CARGO_PACKAGE: wallhack-cli
SCRIPT: .github/scripts/prepare-release.py
SHELL_SCRIPT: .github/scripts/release.sh
BUILD_WORKFLOW: build-and-publish.yml
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Find latest tag
id: tag
env:
GH_TOKEN: ${{ github.token }}
REPO: ${{ github.repository }}
run: bash "$SHELL_SCRIPT" find-latest-tag
- name: Check if HEAD is already tagged
id: guard
env:
GH_TOKEN: ${{ github.token }}
REPO: ${{ github.repository }}
LATEST_TAG: ${{ steps.tag.outputs.latest }}
HEAD_SHA: ${{ github.sha }}
run: bash "$SHELL_SCRIPT" check-tagged
- name: Fetch commit messages
if: steps.guard.outputs.skip == 'false'
env:
GH_TOKEN: ${{ github.token }}
REPO: ${{ github.repository }}
LATEST_TAG: ${{ steps.tag.outputs.latest }}
run: bash "$SHELL_SCRIPT" fetch-commits
- name: Analyze commits
if: steps.guard.outputs.skip == 'false'
env:
LATEST_TAG: ${{ steps.tag.outputs.latest }}
REPO_URL: ${{ github.server_url }}/${{ github.repository }}
run: |
python3 "$SCRIPT" analyze \
--tag-prefix "$TAG_PREFIX" \
--version-file "$VERSION_FILE" \
--package "$CARGO_PACKAGE" \
--latest-tag "$LATEST_TAG" \
--repo-url "$REPO_URL" \
< /tmp/commits.json
- name: Emit outputs
if: steps.guard.outputs.skip == 'false'
id: prepare
run: python3 "$SCRIPT" emit-outputs >> "$GITHUB_OUTPUT"
# --- Path A: version already bumped → tag + draft release + dispatch build ---
- name: Create tag and draft release
if: steps.prepare.outputs.action == 'tag'
env:
GH_TOKEN: ${{ github.token }}
TAG: ${{ steps.prepare.outputs.tag }}
VERSION: ${{ steps.prepare.outputs.version }}
HEAD_SHA: ${{ github.sha }}
LATEST_TAG: ${{ steps.tag.outputs.latest }}
REPO_URL: ${{ github.server_url }}/${{ github.repository }}
GIT_AUTHOR_NAME: ${{ github.actor }}
GIT_AUTHOR_EMAIL: ${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com
run: bash "$SHELL_SCRIPT" create-release
# --- Path B: releasable commits → open/update release PR ---
- name: Install Rust toolchain
if: steps.prepare.outputs.action == 'bump'
run: rustup show
- name: Open or update release PR
if: steps.prepare.outputs.action == 'bump'
env:
GH_TOKEN: ${{ github.token }}
NEW_VERSION: ${{ steps.prepare.outputs.new_version }}
PACKAGE: ${{ steps.prepare.outputs.package }}
TAG: ${{ steps.prepare.outputs.tag }}
LATEST_TAG: ${{ steps.tag.outputs.latest }}
GIT_AUTHOR_NAME: ${{ github.actor }}
GIT_AUTHOR_EMAIL: ${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com
run: bash "$SHELL_SCRIPT" open-pr