-
Notifications
You must be signed in to change notification settings - Fork 0
75 lines (67 loc) · 2.39 KB
/
build.yaml
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
name: build release packages on os
on:
workflow_dispatch: {}
push:
tags: v*
branches: [rapidjson]
pull_request: {}
# https://cli.github.com/manual/gh_release
# https://docs.github.com/en/actions/using-workflows/using-github-cli-in-workflows
jobs:
create-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: gh create release
# TODO use gh release list | grep -q ${{ github.ref_name }}
# to check that it's safe to run release delete
run: |
gh release delete ${{ github.ref_name }} --yes || true # so it doesn't fail when the release doesn't exist
gh release create --latest ${{ github.ref_name }}
env:
GH_TOKEN: ${{ secrets.ACTION_TOKEN }}
# apparently you can't remove v0.1.0.tar.gz and v0.1.0.zip source archives
# - name: gh remove sources
# run: |
# gh release delete-asset ${{ github.ref_name }} ${{ github.ref_name }}.zip --yes
# gh release delete-asset ${{ github.ref_name }} ${{ github.ref_name }}.tar.gz --yes
# env:
# GH_TOKEN: ${{ secrets.ACTION_TOKEN }}
release:
needs: create-release
name: build ${{ matrix.target }}
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-pc-windows-gnu
runs-on: windows-latest
# - target: x86_64-unknown-linux-musl
# runs-on: ubuntu-latest
- target: x86_64-unknown-linux-gnu
runs-on: ubuntu-latest
- target: arm64e-apple-darwin
runs-on: macos-latest
runs-on: ${{ matrix.runs-on }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
- run: rustup default nightly
- name: compile
run: cargo build --release
- name: upload bin to release
if: ${{ runner.os != 'Windows' }}
run: |
cp target/release/jch jch-${{ matrix.target }}-${{ github.ref_name}}
gh release upload ${{ github.ref_name}} jch-${{ matrix.target }}-${{ github.ref_name}}
env:
GH_TOKEN: ${{ secrets.ACTION_TOKEN }}
# also handle windows .exe files
- name: upload exe to release
if: ${{ runner.os == 'Windows' }}
run: |
cp target/release/jch.exe jch-${{ matrix.target }}-${{ github.ref_name}}.exe
gh release upload ${{ github.ref_name}} jch-${{ matrix.target }}-${{ github.ref_name}}.exe
env:
GH_TOKEN: ${{ secrets.ACTION_TOKEN }}