-
Notifications
You must be signed in to change notification settings - Fork 1
99 lines (86 loc) · 2.95 KB
/
build.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
name: Build & Push binaries
permissions:
contents: write
on:
push:
pull_request:
paths-ignore:
- '.gitignore'
- 'LICENSE'
- 'README.md'
env:
CARGO_TERM_COLOR: always
jobs:
build:
strategy:
fail-fast: false
matrix:
platform:
- { runner: windows-latest, os: windows, arch: x64 }
- { runner: ubuntu-latest, os: linux, arch: x86_64 }
- { runner: macos-latest, os: macos, arch: x86_64 }
#- { runner: macos-latest, os: macos, arch: arm64 }
runs-on: ${{ matrix.platform.runner }}
steps:
- uses: actions/checkout@v3
- name: Build and install
run: cargo install --bins --path . --root install --verbose
- name: Set variables
run: |
FILENAME=this_updater_of_mine
if [ "$RUNNER_OS" == "Windows" ]; then
FILENAME=$FILENAME.exe
fi
echo "OUTPUT_PATH=install/bin/$FILENAME" >> $GITHUB_ENV
echo "ASSET_NAME=${{ matrix.platform.os }}_${{ matrix.platform.arch }}_$FILENAME" >> $GITHUB_ENV
shell: bash
- name: Compute checksum of binary
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
sha256sum -b "$OUTPUT_PATH" > "$ASSET_NAME.sha256"
else
shasum -a 256 -b "$OUTPUT_PATH" > "$ASSET_NAME.sha256"
fi
shell: bash
# Nightly tags (for commits to dev branch)
- name: Upload binaries to release (Dev)
uses: svenstaro/upload-release-action@v2
if: ${{ (github.ref == 'refs/heads/dev') && github.event_name == 'push' }}
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ env.OUTPUT_PATH }}
asset_name: ${{ env.ASSET_NAME }}
tag: "0.0.0-nightly"
overwrite: true
body: "Dev branch"
- name: Upload checksum to release (Dev)
uses: svenstaro/upload-release-action@v2
if: ${{ (github.ref == 'refs/heads/dev') && github.event_name == 'push' }}
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ env.ASSET_NAME }}.sha256
asset_name: ${{ env.ASSET_NAME }}.sha256
tag: "0.0.0-nightly"
overwrite: true
body: "Dev branch"
# Release tags (for tags)
- name: Upload binaries to release (Tag)
uses: svenstaro/upload-release-action@v2
if: ${{ startsWith(github.event.ref, 'refs/tags/') }}
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ env.OUTPUT_PATH }}
asset_name: ${{ env.ASSET_NAME }}
tag: ${{ github.ref }}
overwrite: true
body: Version ${{ github.ref }}
- name: Upload checksum to release (Tag)
uses: svenstaro/upload-release-action@v2
if: ${{ startsWith(github.event.ref, 'refs/tags/') }}
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ env.ASSET_NAME }}.sha256
asset_name: ${{ env.ASSET_NAME }}.sha256
tag: ${{ github.ref }}
overwrite: true
body: Version ${{ github.ref }}