Skip to content

Commit 076745d

Browse files
authored
ci: setup release workflow (#44)
1 parent ea25861 commit 076745d

File tree

2 files changed

+109
-0
lines changed

2 files changed

+109
-0
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Build binaries
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
publish-tag:
7+
required: true
8+
type: string
9+
workflow_dispatch:
10+
inputs:
11+
publish-tag:
12+
required: true
13+
type: string
14+
15+
env:
16+
RUST_BACKTRACE: 1
17+
CARGO_TERM_COLOR: always
18+
19+
jobs:
20+
build-and-upload-binary:
21+
name: Build ${{ matrix.target }}
22+
strategy:
23+
matrix:
24+
include:
25+
- target: aarch64-apple-darwin
26+
os: macos-latest
27+
- target: x86_64-unknown-linux-gnu
28+
os: ubuntu-latest
29+
- target: x86_64-apple-darwin
30+
os: macos-latest
31+
- target: x86_64-pc-windows-msvc
32+
os: windows-latest
33+
runs-on: ${{ matrix.os }}
34+
steps:
35+
- uses: actions/checkout@v4
36+
with:
37+
persist-credentials: false
38+
39+
- uses: moonrepo/setup-rust@v1
40+
env:
41+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42+
43+
- uses: taiki-e/upload-rust-binary-action@v1
44+
with:
45+
bin: client,server
46+
target: ${{ matrix.target }}
47+
ref: refs/tags/${{ inputs.publish-tag }}
48+
tar: all
49+
zip: windows
50+
env:
51+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
52+
CARGO_PROFILE_RELEASE_CODEGEN_UNITS: 1
53+
CARGO_PROFILE_RELEASE_LTO: true

.github/workflows/release.yaml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Release
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
publish-tag:
7+
required: true
8+
type: string
9+
10+
concurrency:
11+
group: release
12+
13+
env:
14+
RUST_BACKTRACE: 1
15+
CARGO_TERM_COLOR: always
16+
17+
jobs:
18+
create-release:
19+
name: Create release
20+
runs-on: ubuntu-latest
21+
if: github.ref == 'refs/heads/main'
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v4
25+
with:
26+
persist-credentials: true
27+
28+
- name: Install Rust toolchain
29+
uses: moonrepo/setup-rust@v1
30+
env:
31+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32+
33+
- name: Check and Test
34+
run: cargo check --all-targets --all-features && cargo test
35+
36+
- name: Tag the version
37+
run: |
38+
git tag "${{ inputs.publish-tag }}"
39+
git push origin "${{ inputs.publish-tag }}"
40+
41+
- name: Create github release
42+
uses: taiki-e/create-gh-release-action@v1
43+
with:
44+
branch: main
45+
ref: refs/tags/${{ inputs.publish-tag }}
46+
env:
47+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48+
49+
upload-binary:
50+
name: Run the build-binaries workflow
51+
needs:
52+
- create-release
53+
if: github.ref == 'refs/heads/main'
54+
uses: ./.github/workflows/build-binaries.yaml
55+
with:
56+
publish-tag: ${{ inputs.publish-tag }}

0 commit comments

Comments
 (0)