-
Notifications
You must be signed in to change notification settings - Fork 152
86 lines (77 loc) · 2.73 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
name: release
on:
push:
branches:
- master
tags:
- v*.*.*
workflow_dispatch:
jobs:
build:
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
suffix: ".gz"
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
suffix: ".gz"
- os: macos-latest
target: x86_64-apple-darwin
suffix: ".gz"
- os: macos-latest
target: aarch64-apple-darwin
suffix: ".gz"
- os: windows-latest
target: x86_64-pc-windows-msvc
suffix: ".exe"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
targets: ${{ matrix.target }}
- name: Cache Dependencies
uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
- name: Install Dependencies
if: ${{ matrix.target == 'aarch64-unknown-linux-gnu' }}
run: sudo apt install -y gcc-aarch64-linux-gnu
- run: cargo build --target ${{ matrix.target }} --release
- name: Compress and rename executable
if: ${{ matrix.os != 'windows-latest' }}
run: gzip -c target/${{ matrix.target }}/release/svd2rust > svd2rust-${{ matrix.target }}${{ matrix.suffix }}
- name: Rename executable
if: ${{ matrix.os == 'windows-latest' }}
run: mv target/${{ matrix.target }}/release/svd2rust${{ matrix.suffix }} svd2rust-${{ matrix.target }}${{ matrix.suffix }}
- uses: actions/upload-artifact@v3
with:
name: svd2rust-${{ matrix.target }}
path: svd2rust-${{ matrix.target }}${{ matrix.suffix }}
release:
name: release
runs-on: ubuntu-latest
needs: [build]
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v3
with:
path: artifacts
- run: ls -R ./artifacts
- name: Set current date as environment variable
run: echo "CURRENT_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
- id: changelog-reader
uses: mindsers/[email protected]
with:
version: ${{ (github.ref_type == 'tag' && github.ref_name) || 'Unreleased' }}
- uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.changelog-reader.outputs.version }}
name: ${{ (github.ref_type == 'tag' && steps.changelog-reader.outputs.version) || format('Prereleased {0}', env.CURRENT_DATE) }}
body: ${{ steps.changelog-reader.outputs.changes }}
prerelease: ${{ steps.changelog-reader.outputs.status == 'unreleased' }}
files: |
artifacts/**/*