-
Notifications
You must be signed in to change notification settings - Fork 1
92 lines (86 loc) · 2.55 KB
/
Copy pathrelease.yml
File metadata and controls
92 lines (86 loc) · 2.55 KB
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
name: Release
on:
push:
tags: ["v*"]
permissions:
contents: write
packages: write
env:
CARGO_TERM_COLOR: always
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-binaries:
name: Build ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
- target: x86_64-apple-darwin
os: macos-latest
- target: aarch64-apple-darwin
os: macos-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install cross
if: contains(matrix.target, 'aarch64-unknown-linux')
run: cargo install cross --locked
- name: Build
run: |
if command -v cross &> /dev/null && [[ "${{ matrix.target }}" == *"aarch64-unknown-linux"* ]]; then
cross build --release --target ${{ matrix.target }} -p reach-cli
else
cargo build --release --target ${{ matrix.target }} -p reach-cli
fi
- name: Package
run: |
mkdir -p dist
cp target/${{ matrix.target }}/release/reach dist/reach-${{ matrix.target }} || true
- uses: actions/upload-artifact@v4
with:
name: reach-${{ matrix.target }}
path: dist/
docker-image:
name: Docker Image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/metadata-action@v5
id: meta
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
github-release:
name: GitHub Release
runs-on: ubuntu-latest
needs: [build-binaries, docker-image]
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
path: dist/
merge-multiple: true
- uses: softprops/action-gh-release@v2
with:
files: dist/*
generate_release_notes: true