-
Notifications
You must be signed in to change notification settings - Fork 31
94 lines (80 loc) · 2.75 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
87
88
89
90
91
92
93
94
name: release
on:
push:
branches:
- main
tags:
- v*.*.*
workflow_dispatch:
jobs:
build:
strategy:
matrix:
mode: [release, debug]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Cache Dependencies
uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.mode }}
- name: Build (release mode)
if: matrix.mode == 'release'
run: cargo make
- name: Build (debug mode)
if: matrix.mode == 'debug'
run: cargo make --debug
- name: Compress and Rename Artifact
run: |
gzip -c target/riscv64imac-unknown-none-elf/${{ matrix.mode }}/rustsbi-qemu.bin > rustsbi-qemu-${{ matrix.mode }}.gz
zip rustsbi-qemu-${{ matrix.mode }}.zip target/riscv64imac-unknown-none-elf/${{ matrix.mode }}/rustsbi-qemu.bin
- name: Upload Artifacts
uses: actions/upload-artifact@v2
with:
name: rustsbi-qemu-${{ matrix.mode }}
path: |
rustsbi-qemu-${{ matrix.mode }}.gz
rustsbi-qemu-${{ matrix.mode }}.zip
release:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v3
- name: Download Artifacts
uses: actions/download-artifact@v2
with:
path: artifacts
- name: List Artifacts
run: ls -R ./artifacts
- name: Set current date as environment variable
run: echo "CURRENT_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
- name: Check if pre-release
id: check
run: |
if [[ $GITHUB_REF =~ ^refs/tags/v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "PRE_RELEASE=false" >> $GITHUB_OUTPUT
else
echo "PRE_RELEASE=true" >> $GITHUB_OUTPUT
fi
- name: Get Changelog
id: changelog-reader
uses: mindsers/[email protected]
with:
version: ${{ (steps.check.outputs.PRE_RELEASE && 'Unreleased') || github.ref_name }}
- name: Update Unreleased Tag
if: ${{ steps.changelog-reader.outputs.version == 'Unreleased' }}
uses: richardsimko/update-tag@v1
with:
tag_name: Unreleased
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Release
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' }}
target_commitish: ${{ github.sha }}
files: |
artifacts/**/*