-
Notifications
You must be signed in to change notification settings - Fork 3
119 lines (113 loc) · 3.71 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
109
110
111
112
113
114
115
116
117
118
119
name: Release
on:
push:
branches: [main]
tags-ignore: [dev]
pull_request:
defaults:
run:
shell: bash
# Cancel any in-flight jobs for the same PR/branch so there's only one active
# at a time
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- build: x86_64-linux
os: ubuntu-latest
- build: x86_64-macos
os: macos-latest
target: x86_64-apple-darwin
- build: aarch64-macos
os: macos-latest
- build: x86_64-windows
os: windows-latest
- build: x86_64-mingw
os: windows-latest
target: x86_64-pc-windows-gnu
- build: aarch64-linux
os: ubuntu-latest
target: aarch64-unknown-linux-gnu
- build: s390x-linux
os: ubuntu-latest
target: s390x-unknown-linux-gnu
steps:
- uses: actions/checkout@v2
with:
submodules: true
- uses: ./.github/actions/install-rust
- uses: ./.github/actions/binary-compatible-builds
with:
name: ${{ matrix.build }}
- run: |
echo CARGO_BUILD_TARGET=${{ matrix.target }} >> $GITHUB_ENV
rustup target add ${{ matrix.target }}
if: matrix.target != ''
# Build executable.
- run: $CENTOS cargo build --release --locked
# Assemble release artifats appropriate for this platform, then upload them
# unconditionally to this workflow's files so we have a copy of them.
- run: ./ci/build-tarballs.sh "${{ matrix.build }}" "${{ matrix.target }}"
- uses: actions/upload-artifact@v4
with:
name: bins-${{ matrix.build }}
path: dist
publish:
needs: [build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# Download all the artifacts that we'll be publishing. Should keep an eye on
# the `download-artifact` repository to see if we can ever get something
# like "download all artifacts" or "download this list of artifacts"
- uses: actions/download-artifact@v4
with:
name: bins-x86_64-macos
path: dist
- uses: actions/download-artifact@v4
with:
name: bins-aarch64-macos
path: dist
- uses: actions/download-artifact@v4
with:
name: bins-x86_64-windows
path: dist
- uses: actions/download-artifact@v4
with:
name: bins-x86_64-mingw
path: dist
- uses: actions/download-artifact@v4
with:
name: bins-x86_64-linux
path: dist
- uses: actions/download-artifact@v4
with:
name: bins-aarch64-linux
path: dist
- name: Calculate tag name
run: |
name=dev
if [[ $GITHUB_REF == refs/tags/v* ]]; then
name=${GITHUB_REF:10}
fi
echo ::set-output name=val::$name
echo TAG=$name >> $GITHUB_ENV
id: tagname
# ... and if this was an actual push (tag or `main`) then we publish a
# new release. This'll automatically publish a tag release or update `dev`
# with this `sha`. Note that `continue-on-error` is set here so if this hits
# a bug we can go back and fetch and upload the release ourselves.
- run: cd .github/actions/github-release && npm install --production
- name: Publish Release
uses: ./.github/actions/github-release
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))
with:
files: "dist/*"
token: ${{ secrets.GITHUB_TOKEN }}
name: ${{ steps.tagname.outputs.val }}
continue-on-error: true