-
-
Notifications
You must be signed in to change notification settings - Fork 1
131 lines (115 loc) · 3.83 KB
/
Copy pathrelease.yml
File metadata and controls
131 lines (115 loc) · 3.83 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
name: Release
on:
push:
tags:
- v*
permissions:
contents: write
env:
CARGO_TERM_COLOR: always
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: cargo test --verbose
- run: cargo fmt --all -- --check
publish-crates:
name: Publish to crates.io
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Publish
run: cargo publish --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
create-release:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: taiki-e/create-gh-release-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
upload-assets:
needs: create-release
strategy:
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
- target: x86_64-apple-darwin
os: macos-latest
- target: aarch64-apple-darwin
os: macos-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: taiki-e/upload-rust-binary-action@v1
with:
bin: myssh
target: ${{ matrix.target }}
include: LICENSE,README.md
tar: unix
zip: none
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
update-homebrew-tap:
name: Update Homebrew tap
needs: upload-assets
runs-on: ubuntu-latest
steps:
- name: Get version
id: version
run: echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
- name: Compute checksums
id: checksums
env:
VERSION: ${{ steps.version.outputs.version }}
run: |
intel_url="https://github.com/devtical/myssh/releases/download/v${VERSION}/myssh-x86_64-apple-darwin.tar.gz"
arm_url="https://github.com/devtical/myssh/releases/download/v${VERSION}/myssh-aarch64-apple-darwin.tar.gz"
for attempt in 1 2 3 4 5; do
if curl -fsSL "$intel_url" | sha256sum | awk '{print $1}' > sha256-intel.txt &&
curl -fsSL "$arm_url" | sha256sum | awk '{print $1}' > sha256-arm.txt; then
echo "intel=$(cat sha256-intel.txt)" >> "$GITHUB_OUTPUT"
echo "arm=$(cat sha256-arm.txt)" >> "$GITHUB_OUTPUT"
exit 0
fi
echo "Assets not ready yet, retrying in 15s..."
sleep 15
done
echo "Failed to download release assets"
exit 1
- uses: actions/checkout@v4
with:
repository: devtical/homebrew-formulae
token: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }}
path: homebrew-formulae
- uses: actions/checkout@v4
with:
path: myssh
- name: Update formula
env:
VERSION: ${{ steps.version.outputs.version }}
SHA256_INTEL: ${{ steps.checksums.outputs.intel }}
SHA256_ARM: ${{ steps.checksums.outputs.arm }}
run: |
myssh/.github/scripts/update-homebrew-formula.sh \
"$VERSION" \
"$SHA256_INTEL" \
"$SHA256_ARM" \
"homebrew-formulae/Formula/myssh.rb"
- uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }}
path: homebrew-formulae
commit-message: "myssh ${{ steps.version.outputs.version }}"
title: "myssh ${{ steps.version.outputs.version }}"
body: |
Automated update from [devtical/myssh](https://github.com/devtical/myssh) release v${{ steps.version.outputs.version }}.
branch: "myssh-${{ steps.version.outputs.version }}"
delete-branch: true