-
Notifications
You must be signed in to change notification settings - Fork 0
106 lines (87 loc) · 2.84 KB
/
Copy pathrelease.yml
File metadata and controls
106 lines (87 loc) · 2.84 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
105
106
name: Release
on:
workflow_dispatch:
inputs:
semver-part:
description: "Version bump type"
required: true
type: choice
options:
- patch
- minor
- major
concurrency:
group: release
cancel-in-progress: false
permissions:
contents: write
env:
CARGO_TERM_COLOR: always
jobs:
tests:
uses: ./.github/workflows/tests.yml
release:
needs: tests
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Configure git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Calculate new version
id: version
run: |
output=$(./scripts/calculate-version.sh "${{ inputs.semver-part }}" Cargo.toml)
version=$(echo "$output" | sed -n '1p')
next_dev=$(echo "$output" | sed -n '2p')
echo "version=$version" >> "$GITHUB_OUTPUT"
echo "next_dev=$next_dev" >> "$GITHUB_OUTPUT"
echo "Release version: $version"
echo "Next dev version: $next_dev"
- name: Update Cargo.toml version
run: |
sed -i "s/^version = \".*\"/version = \"${{ steps.version.outputs.version }}\"/" Cargo.toml
- name: Update Cargo.lock
run: cargo update --workspace
- name: Update CHANGELOG.md
run: ./scripts/update-changelog.sh "${{ steps.version.outputs.version }}" "https://github.com/marcinjahn/puff"
- name: Commit release, prepare next dev, and push
run: |
git add Cargo.toml Cargo.lock CHANGELOG.md
git commit -m "release: v${{ steps.version.outputs.version }}"
git tag "v${{ steps.version.outputs.version }}"
sed -i "s/^version = \".*\"/version = \"${{ steps.version.outputs.next_dev }}\"/" Cargo.toml
cargo update --workspace
git add Cargo.toml Cargo.lock
git commit -m "chore: prepare ${{ steps.version.outputs.next_dev }}"
git push origin HEAD:main --tags
github-release:
needs: release
uses: ./.github/workflows/github-release.yml
with:
tag: v${{ needs.release.outputs.version }}
permissions:
contents: write
cargo-publish:
needs: release
uses: ./.github/workflows/cargo-publish.yml
with:
tag: v${{ needs.release.outputs.version }}
secrets: inherit
homebrew-update:
needs: [release, github-release]
uses: ./.github/workflows/homebrew-update.yml
with:
tag: v${{ needs.release.outputs.version }}
secrets: inherit
winget-update:
needs: [release, github-release]
uses: ./.github/workflows/winget-update.yml
with:
tag: v${{ needs.release.outputs.version }}
secrets: inherit