-
Notifications
You must be signed in to change notification settings - Fork 0
96 lines (86 loc) · 3 KB
/
publish-test.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
name: "Publish Test"
on:
pull_request:
concurrency:
group: build-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
publish-mac:
runs-on: macos-latest
strategy:
fail-fast: true
matrix:
build:
- aarch64
- amd64
include:
- build: amd64
target: x86_64-apple-darwin
use-cross: true
features: ""
- build: aarch64
target: aarch64-apple-darwin
use-cross: false
features: ""
steps:
- name: Checkout
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4
with:
fetch-depth: 0
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.target }}
override: true
default: true
- name: Extract crate information
shell: bash
run: |
echo "PROJECT_NAME=$(sed -n 's/^name = "\(.*\)"/\1/p' Cargo.toml | head -n1)" >> $GITHUB_ENV
PROJECT_VERSION="$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -n1)"
echo "PROJECT_VERSION=$PROJECT_VERSION" >> $GITHUB_ENV
if [[ $PROJECT_VERSION == *-pre ]]; then
echo "VERSION_SUFFIX=nightly" >> $GITHUB_ENV
else
echo "VERSION_SUFFIX=$PROJECT_VERSION" >> $GITHUB_ENV
fi
- name: Add build env parameters
shell: bash
run: |
echo "SDKROOT=$(xcrun --show-sdk-path)" >> $GITHUB_ENV
echo "MACOSX_DEPLOYMENT_TARGET=$(xcrun --show-sdk-platform-version)" >> $GITHUB_ENV
- name: Build
uses: actions-rs/cargo@v1
with:
use-cross: ${{ matrix.use-cross }}
command: build
args: ${{ matrix.features }} --release --target=${{ matrix.target }}
- name: Rename binary
run: |
mv target/${{ matrix.target }}/release/${{ env.PROJECT_NAME }} target/release/${{ env.PROJECT_NAME }}_darwin-${{ matrix.build }}-${{ env.VERSION_SUFFIX }}
- name: Publish Release
id: publish
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
prerelease: ${{ github.ref }} == "refs/heads/main"
files: |
target/release/${{ env.PROJECT_NAME }}_darwin-${{ matrix.build }}-${{ env.VERSION_SUFFIX }}
- name: Publish Pre-Release
id: publish-pre
if: ${{ github.ref }} == 'refs/heads/main'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: "ncipollo/release-action@v1"
with:
token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: true
allowUpdates: true
tag: "nightly"
commit: "main"
name: "renku-cli nightly"
replacesArtifacts: true
artifacts: target/release/${{ env.PROJECT_NAME }}_darwin-${{ matrix.build }}-${{ env.VERSION_SUFFIX }}