-
Notifications
You must be signed in to change notification settings - Fork 19
119 lines (106 loc) · 3.57 KB
/
mlar_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
109
110
111
112
113
114
115
116
117
118
119
name: mlar release
on:
push:
tags:
- "mlar-v*"
env:
GITHUB_REF: "${{ github.ref }}"
jobs:
build:
strategy:
matrix:
build: [linux, macos, windows]
include:
- build: linux
os: ubuntu-latest
target: x86_64-unknown-linux-musl
cargo_build: --target x86_64-unknown-linux-musl
- build: macos
os: macos-latest
- build: windows
os: windows-latest
extension: .exe
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Set target if any
if: matrix.target
run: rustup target add ${{ matrix.target }}
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --release --all-features --package mlar --verbose ${{ matrix.cargo_build }}
- name: Strip resulting binary
if: matrix.build == 'linux'
run: strip ./target/${{ matrix.target }}/release/mlar${{ matrix.extension }}
- name: Upload resulting 'mlar'
uses: actions/upload-artifact@v1
with:
name: mlar-${{ matrix.build }}
path: ./target/${{ matrix.target }}/release/mlar${{ matrix.extension }}
release:
# From https://github.com/cloudflare/wrangler/blob/master/.github/workflows/release.yml
name: GitHub Release
needs: build
runs-on: ubuntu-latest
steps:
- name: Query version number
id: get_version
shell: bash
run: |
echo "using version tag ${GITHUB_REF:15}"
echo ::set-output name=version::"${GITHUB_REF:15}"
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: mlar-${{ steps.get_version.outputs.VERSION }}
release_name: mlar-${{ steps.get_version.outputs.VERSION }}
draft: true
- name: Download Linux artifact
uses: actions/download-artifact@v1
with:
name: mlar-linux
- name: Download Windows artifact
uses: actions/download-artifact@v1
with:
name: mlar-windows
- name: Download MacOS artifact
uses: actions/download-artifact@v1
with:
name: mlar-macos
- name: DEBUG
run: ls -ahl ./mlar-linux
- name: Release Linux artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./mlar-linux/mlar
asset_content_type: application/octet-stream
asset_name: mlar-linux-static-${{ steps.get_version.outputs.VERSION }}
- name: Release Windows artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./mlar-windows/mlar.exe
asset_content_type: application/octet-stream
asset_name: mlar-windows-${{ steps.get_version.outputs.VERSION }}
- name: Release MacOS artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./mlar-macos/mlar
asset_content_type: application/octet-stream
asset_name: mlar-macos-${{ steps.get_version.outputs.VERSION }}