-
Notifications
You must be signed in to change notification settings - Fork 11
86 lines (72 loc) · 2.82 KB
/
release.yaml
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
name: Release
on:
push:
tags:
- "v*"
jobs:
release:
runs-on: macos-11
steps:
- uses: actions/checkout@v2
- name: Get version
id: get_version
run: echo ::set-output name=version::${GITHUB_REF/refs\/tags\//}
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: aarch64-apple-darwin
- uses: actions-rs/cargo@v1
with:
command: build
args: --release --target=x86_64-apple-darwin
- uses: actions-rs/cargo@v1
with:
command: build
args: --release --target=aarch64-apple-darwin
- uses: actions-rs/cargo@v1
with:
command: publish
args: --token=${{ secrets.CRATES_TOKEN }}
- name: Universal binary
run: |
mkdir -p target/universal-apple-darwin/release
lipo -create -output target/universal-apple-darwin/release/ds target/aarch64-apple-darwin/release/ds target/x86_64-apple-darwin/release/ds
- name: Create tar
run: |
tar -C ./target/universal-apple-darwin/release/ -czf dirstat-rs-${{ steps.get_version.outputs.version }}-universal-apple-darwin.tar.gz ./ds
- name: Set SHA
id: shasum
run: |
echo ::set-output name=sha::"$(shasum -a 256 ./dirstat-rs-${{ steps.get_version.outputs.version }}-universal-apple-darwin.tar.gz | awk '{printf $1}')"
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: dirstat-rs-${{ steps.get_version.outputs.version }}-universal-apple-darwin.tar.gz
asset_name: dirstat-rs-${{ steps.get_version.outputs.version }}-universal-apple-darwin.tar.gz
asset_content_type: application/gzip
- uses: mislav/bump-homebrew-formula-action@v1
if: "!contains(github.ref, '-')"
with:
formula-name: dirstat-rs
formula-path: Formula/dirstat-rs.rb
homebrew-tap: scullionw/homebrew-tap
base-branch: main
download-url: https://github.com/scullionw/dirstat-rs/releases/download/${{ steps.get_version.outputs.version }}/dirstat-rs-${{ steps.get_version.outputs.version }}-universal-apple-darwin.tar.gz
download-sha256: ${{ steps.shasum.outputs.sha }}
commit-message: |
{{formulaName}} {{version}}
env:
COMMITTER_TOKEN: ${{ secrets.BREW_TOKEN }}