-
Notifications
You must be signed in to change notification settings - Fork 13
83 lines (78 loc) · 2.67 KB
/
release.yaml
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
on:
push:
tags:
- 'v[0-9]+.*'
name: Release
jobs:
create_release:
name: Create release
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: true # todo: change to false
prerelease: true
crates:
name: Publish schematools on crates.io
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- run: cargo publish -p schematools --token ${CRATES_TOKEN}
env:
CRATES_TOKEN: ${{ secrets.CRATES_TOKEN }}
- run: cargo publish -p schematools-cli --token ${CRATES_TOKEN}
env:
CRATES_TOKEN: ${{ secrets.CRATES_TOKEN }}
release_assets:
name: Release assets
needs: create_release
runs-on: ${{ matrix.config.os }}
strategy:
matrix:
config:
- os: ubuntu-22.04
target: x86_64-unknown-linux-gnu
short: linux-amd64
- os: macos-13
target: x86_64-apple-darwin
short: darwin-amd64
- os: windows-latest
target: x86_64-pc-windows-msvc
short: windows-amd64
extension: .exe
- os: macos-14
target: aarch64-apple-darwin
short: darwin-arm64
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.config.target }}
default: true
override: true
- run: cargo build --release
- run: strip target/release/schematools-cli${{ matrix.config.extension }}
- run: mv target/release/schematools-cli${{ matrix.config.extension }} target/release/schematools-${{ matrix.config.short }}${{ matrix.config.extension }}
- run: tar -czf target/release/schematools-${{ matrix.config.short }}.tar.gz -C ./target/release schematools-${{ matrix.config.short }}${{ matrix.config.extension }}
# upload files
- name: Upload release assets
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_name: schematools-${{ matrix.config.short }}.tar.gz
asset_path: ./target/release/schematools-${{ matrix.config.short }}.tar.gz
asset_content_type: application/tar+gzip