-
Notifications
You must be signed in to change notification settings - Fork 12
98 lines (91 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
95
96
97
98
on:
push:
tags:
- 'v*'
name: Upload Release Asset
env:
NAME: RustyDO
jobs:
create_release:
permissions: write-all
name: Create Release
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Get Version from Tag
id: tag_name
run: |
echo ::set-output name=current_version::${GITHUB_REF#refs/tags/v}
shell: bash
- name: Checkout
uses: actions/checkout@v2
- name: Get Changelog
id: changelog_reader
uses: mindsers/changelog-reader-action@v2
with:
version: ${{ steps.tag_name.outputs.current_version }}
path: ./CHANGELOG.md
- name: Create Release
id: create_release
uses: actions/create-release@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{env.BUILD_CONFIGURATION}} ${{ github.ref }}
body: ${{ steps.changelog_reader.outputs.changes }}
draft: false
prerelease: false
build:
permissions: write-all
name: Upload Release Asset
runs-on: ubuntu-latest
needs: create_release
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-pc-windows-gnu
name: win-x86_64
ext: .exe
- target: x86_64-unknown-linux-musl
name: linux-x86_64
ext:
- target: aarch64-unknown-linux-musl
name: linux-arm64
ext:
steps:
- name: Checkout
uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.target }}
override: true
- name: Get Executable Name
id: extname
shell: bash
run: |
echo "name=$PROJ_NAME$CURR_EXT" >> $GITHUB_OUTPUT
env:
PROJ_NAME: ${{env.NAME}}
CURR_EXT: ${{matrix.ext}}
- uses: actions-rs/cargo@v1
with:
use-cross: true
command: build
args: --release --target=${{ matrix.target }} --target-dir ./build
- name: Zip
run: |
zip -j ${{env.NAME}}-${{matrix.name}}.zip ./build/${{matrix.target}}/release/${{steps.extname.outputs.name}} README.md CHANGELOG.md config.toml
- name: Upload Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: ./${{env.NAME}}-${{matrix.name}}.zip
asset_name: ${{env.NAME}}-${{matrix.name}}.zip
asset_content_type: application/zip