-
Notifications
You must be signed in to change notification settings - Fork 5
129 lines (113 loc) · 3.78 KB
/
release.yml
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
name: Release
on:
push:
tags:
- 'v*'
jobs:
prepare-artifacts:
name: Prepare release artifacts
# if: github.ref == 'refs/heads/main'
runs-on: '${{ matrix.os }}'
strategy:
matrix:
include:
- os: macos-latest
target: aarch64-apple-darwin
rust: stable
suffix: ''
archive_ext: zip
steps:
- name: Rust install
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: rustfmt, clippy
- name: checkout
uses: actions/checkout@v4
- name: Cache crates from crates.io
uses: actions/cache@v4
continue-on-error: false
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: '${{ runner.os }}-${{ matrix.target }}-cargo-${{ matrix.rust }}-hash-${{ hashFiles(''**/Cargo.lock'') }}'
- name: Build Release
run: cargo build --release
- name: Compress to zip (macOS)
if: ${{ matrix.os == 'macos-latest' }}
run:
zip -A ${{ github.event.repository.name }}-${{ matrix.target }}.${{ matrix.archive_ext }} target/release/${{ github.event.repository.name }}
- name: List files
run: |
ls -alF .
ls -alF target/release/
shell: bash
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ github.event.repository.name }}-${{ matrix.target }}.${{ matrix.archive_ext }}
path: ${{ github.event.repository.name }}-${{ matrix.target }}.${{ matrix.archive_ext }}
release:
name: Create a GitHub Release
# if: github.ref == 'refs/heads/main'
runs-on: macos-latest
permissions:
contents: write
needs:
- prepare-artifacts
steps:
- name: checkout
uses: actions/checkout@v4
with:
# convco needs all history to create the changelog
fetch-depth: 0
- name: Extract version
id: extract-version
run: |
echo "tag-name=${GITHUB_REF#refs/tags/}" >> ${GITHUB_OUTPUT}
- name: Download convco
run: |
git show-ref
curl -sSfLO https://github.com/convco/convco/releases/latest/download/convco-macos.zip
unzip convco-macos.zip
chmod +x convco
- name: Use convco to create the changelog
run: |
./convco changelog -c .convco --max-versions 1 --include-hidden-sections > CHANGELOG.md
rm convco convco-macos.zip
- uses: actions/download-artifact@v4
with:
name: ${{ github.event.repository.name }}-aarch64-apple-darwin.zip
- uses: ncipollo/release-action@v1
with:
artifacts: "*.zip,*.tar.xz"
bodyFile: "CHANGELOG.md"
token: ${{ secrets.GITHUB_TOKEN }}
homebrew:
name: Bump Homebrew formula
# if: github.ref == 'refs/heads/main'
runs-on: macos-latest
needs:
- release
steps:
- name: Extract version
id: extract-version
run: |
echo "tag-name=${GITHUB_REF#refs/tags/}" >> ${GITHUB_OUTPUT}
- uses: mislav/bump-homebrew-formula-action@v3
if: "!contains(github.ref, '-')" # skip prereleases
with:
formula-name: pumas
homebrew-tap: graelo/homebrew-tap
# base-branch: main
create-pullrequest: true
download-url: https://github.com/graelo/pumas/archive/refs/tags/${{ steps.extract-version.outputs.tag-name }}.tar.gz
commit-message: |
{{formulaName}} {{version}}
Created by https://github.com/mislav/bump-homebrew-formula-action
env:
COMMITTER_TOKEN: ${{ secrets.COMMITTER_TOKEN }}