-
Notifications
You must be signed in to change notification settings - Fork 6
94 lines (79 loc) · 2.5 KB
/
ship.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: rust / ship
on:
push:
branches: [main]
workflow_dispatch:
inputs:
release: # set to true to trigger a release
description: Trigger a release
required: false
default: 'false'
tag: # example: x.y.z-rc.w
description: Release tag
required: false
env:
CARGO_TERM_COLOR: always
jobs:
build:
name: ${{ matrix.os }} / ${{ matrix.target }}
runs-on: ${{ matrix.os }}
timeout-minutes: 60
strategy:
fail-fast: true
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
cross: false
- os: windows-latest
target: x86_64-pc-windows-msvc
cross: false
- os: macos-latest
target: x86_64-apple-darwin
cross: false
steps:
- name: Checkout repo
uses: actions/checkout@v2
- uses: dtolnay/rust-toolchain@stable
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --color always --release --locked --target ${{ matrix.target }}
use-cross: ${{ matrix.cross }}
- name: Get Binary path
id: binary
run: echo "::set-output name=path::target/${{ matrix.target }}/release/three_em${{ runner.os == 'windows' && '.exe' || '' }}"
- name: Zip Builds
shell: pwsh
run: Compress-Archive -CompressionLevel Optimal -Force -Path ${{ steps.binary.outputs.path }}, README.md, LICENSE -DestinationPath three_em-${{ matrix.target }}.zip
- name: Upload Release Builds
uses: actions/upload-artifact@v2
with:
name: release
path: three_em-${{ matrix.target }}.zip
if-no-files-found: error
retention-days: 1
publish:
if: github.event.inputs.release == 'true' && github.event.inputs.tag != ''
needs: build
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Download Builds
uses: actions/download-artifact@v2
with:
path: artifacts
- name: Release
uses: ncipollo/release-action@v1
with:
tag: ${{ github.event.inputs.tag }}
name: v${{ github.event.inputs.tag }}
prerelease: contains(github.event.inputs.tag, '-')
discussionCategory: 'announcements'
draft: true
allowUpdates: true
replacesArtifacts: true
artifacts: 'artifacts/release/*.zip'
generateReleaseNotes: true
token: ${{ github.token }}