|
3 | 3 | push: |
4 | 4 | # Sequence of patterns matched against refs/tags |
5 | 5 | tags: |
6 | | - - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 |
| 6 | + - "v*" # Push events to matching v*, i.e. v1.0, v20.15.10 |
7 | 7 |
|
8 | 8 | jobs: |
9 | 9 | homebrew: |
10 | 10 | name: "Create homebrew release" |
11 | 11 | runs-on: macos-latest |
12 | 12 | steps: |
13 | | - - name: Get tag |
14 | | - id: push |
15 | | - run: | |
16 | | - echo ::set-output name=name::${GITHUB_REF#refs/*/} |
17 | | - echo ::set-output name=branch::${GITHUB_REF#refs/heads/} |
18 | | - echo ::set-output name=tag::${GITHUB_REF#refs/tags/} |
19 | | - echo ::set-output name=tag_unprefixed::${GITHUB_REF#refs/tags/v} |
| 13 | + - uses: actions/checkout@v4 |
20 | 14 |
|
21 | | - - uses: actions/checkout@v2 |
22 | | - - name: Install latest nightly |
23 | | - uses: actions-rs/toolchain@v1 |
24 | | - with: |
25 | | - toolchain: nightly |
26 | | - override: true |
| 15 | + - uses: dtolnay/rust-toolchain@stable |
27 | 16 |
|
28 | | - - name: Run cargo build --release |
29 | | - uses: actions-rs/cargo@v1 |
30 | | - with: |
31 | | - command: build |
32 | | - args: --release |
| 17 | + - name: Build |
| 18 | + run: | |
| 19 | + rustup target add x86_64-apple-darwin |
| 20 | + rustup target add aarch64-apple-darwin |
| 21 | + cargo build --release --target x86_64-apple-darwin |
| 22 | + cargo build --release --target aarch64-apple-darwin |
33 | 23 |
|
34 | | - - name: Homebrew archive and shasum |
| 24 | + - name: Create universal binary |
35 | 25 | id: archive |
36 | 26 | run: | |
37 | | - cd target/release |
38 | | - tar -czf dark-notify-${{ steps.push.outputs.tag }}.tar.gz dark-notify |
39 | | - SUM=$(shasum -a 256 dark-notify-${{ steps.push.outputs.tag }}.tar.gz | awk '{print $1}') |
40 | | - echo "::set-output name=shasum::$SUM" |
| 27 | + lipo -create -output ./dark-notify target/x86_64-apple-darwin/release/dark-notify target/aarch64-apple-darwin/release/dark-notify |
| 28 | + tar -czvf dark-notify.tar.gz ./dark-notify |
41 | 29 |
|
42 | | - - name: Create Release |
43 | | - id: create_release |
44 | | - uses: actions/create-release@v1 |
45 | | - env: |
46 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
47 | | - with: |
48 | | - tag_name: ${{ steps.push.outputs.tag }} |
49 | | - release_name: Release ${{ steps.push.outputs.tag }} |
50 | | - draft: false |
51 | | - prerelease: false |
| 30 | + SUM=$(shasum -a 256 dark-notify.tar.gz | awk '{print $1}') |
| 31 | + echo "shasum=$SUM" >> $GITHUB_OUTPUT |
52 | 32 |
|
53 | | - - name: Upload Release Asset |
54 | | - id: upload_release_asset |
55 | | - uses: actions/upload-release-asset@v1 |
56 | | - env: |
57 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 33 | + - name: Release |
| 34 | + id: release |
| 35 | + uses: softprops/action-gh-release@v2 |
58 | 36 | with: |
59 | | - upload_url: ${{ steps.create_release.outputs.upload_url }} |
60 | | - asset_path: target/release/dark-notify-${{ steps.push.outputs.tag }}.tar.gz |
61 | | - asset_name: dark-notify-${{ steps.push.outputs.tag }}.tar.gz |
62 | | - asset_content_type: application/gzip |
| 37 | + tag_name: ${{ github.ref_name }} |
| 38 | + name: Release ${{ github.ref_name }} |
| 39 | + files: | |
| 40 | + dark-notify.tar.gz |
| 41 | + fail_on_unmatched_files: true |
| 42 | + |
| 43 | + - name: Get asset URL |
| 44 | + id: get_url |
| 45 | + run: | |
| 46 | + URL="${{ fromJson(steps.release.outputs.assets)[0].browser_download_url }}" |
| 47 | + echo "url=$URL" >> $GITHUB_OUTPUT |
63 | 48 |
|
64 | 49 | - name: Update Homebrew formula |
65 | 50 | env: |
66 | 51 | HOMEBREW_GITHUB_API_TOKEN: ${{ secrets.BREW_TOKEN }} |
| 52 | + VERSION: ${{ github.ref_name }} |
67 | 53 | run: | |
68 | 54 | brew tap cormacrelf/tap |
69 | 55 | brew bump-formula-pr -f --no-browse --no-audit \ |
70 | | - --version='${{ steps.push.outputs.tag_unprefixed }}' \ |
71 | | - --sha256='${{ steps.archive.outputs.shasum }}' \ |
72 | | - --url='${{ steps.upload_release_asset.outputs.browser_download_url }}' \ |
| 56 | + --version="${VERSION#v}" \ |
| 57 | + --sha256="${{ steps.archive.outputs.shasum }}" \ |
| 58 | + --url="${{ steps.get_url.outputs.url }}" \ |
73 | 59 | cormacrelf/tap/dark-notify |
74 | | -
|
0 commit comments