-
Notifications
You must be signed in to change notification settings - Fork 21
102 lines (90 loc) · 3.02 KB
/
release.yml
File metadata and controls
102 lines (90 loc) · 3.02 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
name: Release on tag
on:
push:
tags:
- "v*"
workflow_dispatch:
permissions:
contents: write
jobs:
build-musl-binaries:
strategy:
matrix:
include:
- target: x86_64-unknown-linux-musl
runner: ubuntu-24.04
- target: aarch64-unknown-linux-musl
runner: codspeedhq-arm64-ubuntu-24.04
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- uses: moonrepo/setup-rust@v1
with:
targets: ${{ matrix.target }}
- name: Install musl tools
run: sudo apt-get update && sudo apt-get install -y musl-tools
- run: cargo build --locked --release --bin cargo-codspeed --target ${{ matrix.target }}
- name: Upload binary as artifact
uses: actions/upload-artifact@v4
with:
name: cargo-codspeed-${{ matrix.target }}
path: ./target/${{ matrix.target }}/release/cargo-codspeed
if-no-files-found: error
publish:
needs: build-musl-binaries
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- uses: moonrepo/setup-rust@v0
with:
cache-target: release
bins: cargo-workspaces
- name: Build
run: cargo build --release
- name: Publish package
if: github.event_name != 'workflow_dispatch'
run: cargo workspaces publish --from-git
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
- name: Create a draft release
id: create_release
if: github.event_name != 'workflow_dispatch'
run: |
NEW_VERSION=$(cargo workspaces ls --json | jq -r '.[] | select(.name == "codspeed") | .version')
gh release create v$NEW_VERSION --title "v$NEW_VERSION" --generate-notes -d
echo "upload_url=$(gh release view v$NEW_VERSION --json uploadUrl | jq -r '.uploadUrl')" >> $GITHUB_OUTPUT
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
upload-binaries:
needs: publish
strategy:
fail-fast: false
matrix:
target:
- x86_64-unknown-linux-musl
- aarch64-unknown-linux-musl
runs-on: ubuntu-latest
steps:
- name: Download binary artifact
uses: actions/download-artifact@v4
with:
name: cargo-codspeed-${{ matrix.target }}
path: ./target/${{ matrix.target }}/release
- name: Upload Release Asset
if: github.event_name != 'workflow_dispatch'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.publish.outputs.upload_url }}
asset_path: ./target/${{ matrix.target }}/release/cargo-codspeed
asset_name: cargo-codspeed-${{ matrix.target }}
asset_content_type: application/octet-stream