-
-
Notifications
You must be signed in to change notification settings - Fork 7
108 lines (98 loc) · 2.89 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
99
100
101
102
103
104
105
106
107
108
on:
push:
tags: '*'
name: Create Release
jobs:
publish-crate:
name: Publish to crates.io
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
- name: Setup Chomp
with:
version: 0.2.11
uses: guybedford/chomp-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: cargo login ${CRATES_IO_TOKEN}
env:
CRATES_IO_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
- run: chomp build:release
- name: publish chomp
run: cargo publish
create-github-release:
name: Create GitHub Release
needs: publish-crate
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Create Release Notes
uses: actions/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
await github.request(`POST /repos/${{ github.repository }}/releases`, {
tag_name: "${{ github.ref }}",
generate_release_notes: true
});
build:
name: Build assets for ${{ matrix.os }}
needs: create-github-release
runs-on: ${{ matrix.os }}
strategy:
matrix:
name: [
linux,
windows,
macos
]
include:
- name: linux
os: ubuntu-latest
artifact_name: chomp
asset_name: chomp-linux
asset_extension: .tar.gz
- name: windows
os: windows-latest
artifact_name: chomp.exe
asset_name: chomp-windows
asset_extension: .zip
- name: macos
os: macos-latest
artifact_name: chomp
asset_name: chomp-macos
asset_extension: .tar.gz
steps:
- uses: actions/checkout@v1
- name: Set env
run: |
RELEASE_VERSION=$(echo ${GITHUB_REF:10})
echo "asset_name=${{ matrix.asset_name }}-${RELEASE_VERSION}${{ matrix.asset_extension }}" >> $GITHUB_ENV
shell: bash
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
- name: Build
run: cargo build --release --locked
- name: Archive release
shell: bash
run: |
cp "target/release/${{ matrix.artifact_name }}" "${{ matrix.artifact_name }}"
if [ "${{ matrix.os }}" = "windows-latest" ]; then
7z a "${asset_name}" "${{ matrix.artifact_name }}"
else
tar czf "${asset_name}" "${{ matrix.artifact_name }}"
fi
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v1-release
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: chomp*${{ matrix.asset_extension }}
file_glob: true
tag: ${{ github.ref }}