-
Notifications
You must be signed in to change notification settings - Fork 2
93 lines (72 loc) · 2.69 KB
/
publish-cli.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
name: Publish CLI
on:
push:
tags:
- "cli-[0-9]+.[0-9]+.[0-9]+"
env:
CARGO_TERM_COLOR: always
jobs:
test:
uses: ./.github/workflows/test.yml
with:
package: cambridge-asm-cli
publish:
name: Publish crate
runs-on: ubuntu-latest
environment: Release
needs: test
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Cargo login
run: cargo login ${{ secrets.CARGO_API_TOKEN }}
- name: Publish crate
run: cargo publish -p cambridge-asm-cli
release:
name: Publish CLI
strategy:
fail-fast: false
matrix:
caie: [true, false]
target: ['x86_64-unknown-linux-gnu', 'aarch64-unknown-linux-gnu', 'riscv64gc-unknown-linux-gnu', x86_64-pc-windows-gnu]
runs-on: ubuntu-latest
permissions:
contents: write
container: ghcr.io/saadisave/cambridge-asm-ci:latest
environment: Release
needs: test
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- run: git config --system --add safe.directory /__w/cambridge-asm/cambridge-asm
- name: Set release version
run: export RELEASE_VERSION=$(python3 .github/getversion-cli.py) && echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV
- name: Build
if: ${{ !matrix.caie}}
run: cargo build --profile prod --target ${{ matrix.target }} -p cambridge-asm-cli
- name: Build caie
if: matrix.caie
run: cargo build --no-default-features --profile prod --target ${{ matrix.target }} -p cambridge-asm-cli
- run: mkdir release
- name: Zip
if: ${{ !contains(matrix.target, 'windows') }}
run: zip -j release/cambridge-asm-${{ matrix.target }} target/${{ matrix.target }}/prod/casm README.md LICENSE
- name: Zip windows
if: contains(matrix.target, 'windows')
run: zip -j release/cambridge-asm-${{ matrix.target }} target/${{ matrix.target }}/prod/casm.exe README.md LICENSE
- name: Checksum
run: sha256sum release/cambridge-asm-${{ matrix.target }}.zip > release/cambridge-asm-${{ matrix.target }}.zip.sha256sum
- name: Rename caie
if: matrix.caie
run: mv release/cambridge-asm-${{ matrix.target }}.zip release/cambridge-asm-${{ matrix.target }}-caie.zip &&
mv release/cambridge-asm-${{ matrix.target }}.zip.sha256sum release/cambridge-asm-${{ matrix.target }}-caie.zip.sha256sum
- name: Release
uses: ncipollo/release-action@v1
with:
artifacts: release/*
allowUpdates: true
name: cli-${{ env.RELEASE_VERSION }}