-
Notifications
You must be signed in to change notification settings - Fork 2
92 lines (79 loc) · 2.6 KB
/
rust.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
name: Rust Build and Artifact Creation
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
toolchain: [stable, nightly]
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- os: windows-latest
target: x86_64-pc-windows-msvc
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
target: ${{ matrix.target }}
toolchain: ${{ matrix.toolchain }}
override: true
- name: Build and Install Binary
run: |
mkdir -p ${{github.workspace}}/install
cargo install --path '${{github.workspace}}' --root '${{github.workspace}}/install' --target ${{ matrix.target }}
shell: bash
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}-${{ matrix.toolchain }}-binary
path: ${{github.workspace}}/install/bin
create-nightly-release:
name: Create nightly
#if: github.ref == 'refs/heads/master'
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Consolidate artifacts
uses: actions/download-artifact@v4
with:
pattern: '*-latest-nightly-binary'
merge-multiple: true
- name: Rename artifacts
run: |
LIBSHV_GIT_HASH="$(printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)")"
mv cp2cp "cp2cp-${LIBSHV_GIT_HASH}"
mv cp2cp.exe "cp2cp-${LIBSHV_GIT_HASH}.exe"
- name: Remove previous Nightly assets
run: |
readarray -t PREVIOUS_ASSETS < <(gh release view nightly --json assets --jq .assets[].name)
for PREVIOUS_ASSET in "${PREVIOUS_ASSETS[@]}"; do
gh release delete-asset nightly "${PREVIOUS_ASSET}" --yes
done
env:
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Release
uses: softprops/action-gh-release@v2
with:
name: Nightly
tag_name: nightly
fail_on_unmatched_files: true
body: |
The latest and greatest.
This is a nightly release. If you find any bugs, please report them to the repository's issue tracker.
files: |
cp2cp*