-
Notifications
You must be signed in to change notification settings - Fork 0
112 lines (106 loc) · 3.23 KB
/
Copy pathrelease.yml
File metadata and controls
112 lines (106 loc) · 3.23 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
name: release
on:
push:
tags:
- "v*.*.*"
permissions:
contents: write
jobs:
build-macos:
runs-on: macos-15
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-apple-darwin
arch: x86_64
- target: aarch64-apple-darwin
arch: arm64
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Build
run: cargo build --release --target ${{ matrix.target }}
- name: Package
shell: bash
run: |
set -euo pipefail
version="${GITHUB_REF_NAME#v}"
arch="${{ matrix.arch }}"
artifact="mdlint-${version}-macos-${arch}.tar.gz"
tar -C target/${{ matrix.target }}/release -czf "${artifact}" mdlint
shasum -a 256 "${artifact}" > "${artifact}.sha256"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: mdlint-macos-${{ matrix.arch }}
path: |
mdlint-*.tar.gz
mdlint-*.sha256
build-linux:
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
arch: x86_64
runner: ubuntu-latest
- target: aarch64-unknown-linux-gnu
arch: arm64
runner: ubuntu-24.04-arm
runs-on: ${{ matrix.runner }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Build
run: cargo build --release --target ${{ matrix.target }}
- name: Package
shell: bash
run: |
set -euo pipefail
version="${GITHUB_REF_NAME#v}"
arch="${{ matrix.arch }}"
artifact="mdlint-${version}-linux-${arch}.tar.gz"
tar -C target/${{ matrix.target }}/release -czf "${artifact}" mdlint
sha256sum "${artifact}" > "${artifact}.sha256"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: mdlint-linux-${{ matrix.arch }}
path: |
mdlint-*.tar.gz
mdlint-*.sha256
release:
needs: [build-macos, build-linux]
runs-on: ubuntu-latest
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true
- name: Upload release assets
uses: softprops/action-gh-release@v2
with:
files: artifacts/*
update-homebrew:
needs: release
runs-on: ubuntu-latest
steps:
- name: Trigger homebrew-tap update
run: |
VERSION="${GITHUB_REF_NAME#v}"
VERSION="${VERSION#v}"
curl -X POST \
-H "Authorization: token ${{ secrets.HOMEBREW_TAP_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/sidequery/homebrew-tap/dispatches \
-d "{\"event_type\":\"update-formula\",\"client_payload\":{\"formula\":\"mdlint\",\"version\":\"${VERSION}\",\"repo\":\"sidequery/mdlint\"}}"