-
Notifications
You must be signed in to change notification settings - Fork 9
72 lines (63 loc) · 2.15 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
name: Release on tag
on:
push:
tags:
- "v*"
permissions:
contents: write
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: moonrepo/setup-rust@v0
with:
cache-target: release
bins: cargo-workspaces
- name: Build
run: cargo build --release
- name: Publish package
run: cargo workspaces publish --from-git
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
- name: Create a draft release
id: create_release
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 }}
build-upload-binaries:
needs: publish
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: moonrepo/setup-rust@v0
with:
targets: ${{ matrix.target }}
cache-target: ${{ matrix.target }}/release
# TODO: Reenable when we have a way to build for other targets
# - name: Setup environment for target
# if: ${{ matrix.setup }}
# run: ${{ matrix.setup }}
- run: cargo build --release --features vendored-openssl --bin cargo-codspeed --target ${{ matrix.target }}
- name: Upload Release Asset
id: upload-release-asset
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