forked from timothyandrew/gh-stack
-
Notifications
You must be signed in to change notification settings - Fork 6
133 lines (125 loc) · 4.16 KB
/
Copy pathrelease.yml
File metadata and controls
133 lines (125 loc) · 4.16 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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
name: Release
on:
push:
tags:
- 'v*'
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
- name: Check formatting
run: cargo fmt --check
- name: Run clippy
run: cargo clippy -- -D warnings
- name: Run tests
run: cargo test
build-macos:
needs: test
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-apple-darwin,aarch64-apple-darwin
- name: Build x86_64
run: cargo build --release --target x86_64-apple-darwin
- name: Build arm64
run: cargo build --release --target aarch64-apple-darwin
- name: Create universal binary
run: |
lipo -create \
target/x86_64-apple-darwin/release/gh-stack \
target/aarch64-apple-darwin/release/gh-stack \
-output gh-stack
- name: Package
run: tar -czvf gh-stack-mac.tar.gz gh-stack
- uses: actions/upload-artifact@v4
with:
name: gh-stack-mac
path: gh-stack-mac.tar.gz
build-linux:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Build
run: cargo build --release
- name: Package
run: tar -czvf gh-stack-linux.tar.gz -C target/release gh-stack
- uses: actions/upload-artifact@v4
with:
name: gh-stack-linux
path: gh-stack-linux.tar.gz
release:
needs: [build-macos, build-linux]
runs-on: ubuntu-latest
permissions:
contents: write
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- name: Get version
id: version
run: |
VERSION=${GITHUB_REF#refs/tags/}
echo "version=$VERSION" >> $GITHUB_OUTPUT
- uses: actions/download-artifact@v4
- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: |
gh-stack-mac/gh-stack-mac.tar.gz
gh-stack-linux/gh-stack-linux.tar.gz
generate_release_notes: true
update-homebrew:
needs: release
runs-on: ubuntu-latest
steps:
- name: Get version
id: version
run: |
VERSION=${GITHUB_REF#refs/tags/}
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Download mac binary and get sha256
id: sha
run: |
curl -L -o gh-stack-mac.tar.gz \
"https://github.com/luqven/gh-stack/releases/download/${{ steps.version.outputs.version }}/gh-stack-mac.tar.gz"
SHA=$(shasum -a 256 gh-stack-mac.tar.gz | cut -d ' ' -f 1)
echo "sha256=$SHA" >> $GITHUB_OUTPUT
- uses: actions/checkout@v4
with:
repository: luqven/homebrew-gh-stack
token: ${{ secrets.HOMEBREW_PAT }}
path: homebrew-gh-stack
- name: Update formula
run: |
cat > homebrew-gh-stack/Formula/gh-stack.rb << EOF
class GhStack < Formula
desc "Manage PR stacks/chains on Github"
homepage "https://github.com/luqven/gh-stack"
version "${{ steps.version.outputs.version }}"
url "https://github.com/luqven/gh-stack/releases/download/#{version}/gh-stack-mac.tar.gz"
sha256 "${{ steps.sha.outputs.sha256 }}"
def install
bin.install "gh-stack"
end
end
EOF
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.HOMEBREW_PAT }}
path: homebrew-gh-stack
commit-message: "bump gh-stack to ${{ steps.version.outputs.version }}"
title: "bump gh-stack to ${{ steps.version.outputs.version }}"
body: |
Automated PR to update gh-stack to ${{ steps.version.outputs.version }}
Release: https://github.com/luqven/gh-stack/releases/tag/${{ steps.version.outputs.version }}
branch: "bump-${{ steps.version.outputs.version }}"
base: main