Repository navigation
102 lines (88 loc) · 2.76 KB
/
Copy pathvdev_publish.yml
File metadata and controls
102 lines (88 loc) · 2.76 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
93
94
95
96
97
98
99
100
101
102
name: Publish vdev
on:
push:
tags: ["vdev-v*.*.*"]
permissions:
contents: read # Restrictive default
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: macos-latest
target: aarch64-apple-darwin
- os: ubuntu-24.04
target: x86_64-unknown-linux-gnu
- os: ubuntu-24.04-arm
target: aarch64-unknown-linux-gnu
steps:
- name: Checkout Vector
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: ./.github/actions/setup
with:
rust: true
vdev: false
- name: Build
working-directory: vdev
run: cargo build --release --target ${{ matrix.target }}
- name: Package
shell: bash
run: |
VERSION=${GITHUB_REF_NAME#vdev-v}
OUTDIR="vdev-${{ matrix.target }}-v${VERSION}"
mkdir -p "$OUTDIR"
BIN_ROOT="${CARGO_TARGET_DIR:-target}"
BIN="${BIN_ROOT}/${{ matrix.target }}/release/vdev"
if [[ ! -f "$BIN" ]]; then
echo "Binary not found at: $BIN"
find "${BIN_ROOT}" -type -d
exit 1
fi
cp "$BIN" "$OUTDIR/"
tar -czf "${OUTDIR}.tgz" "$OUTDIR"
echo "ASSET=${OUTDIR}.tgz" >> "$GITHUB_ENV"
- name: Stage asset for release
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: vdev-${{ matrix.target }}
path: ${{ env.ASSET }}
if-no-files-found: error
# Create and publish the release from one job to avoid races.
release:
runs-on: ubuntu-24.04
needs: build
permissions:
contents: write # Required to create the release and upload assets
steps:
- name: Download staged assets
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
pattern: vdev-*
path: assets
merge-multiple: true
- name: Publish GitHub release
uses: softprops/action-gh-release@efb35369e0ad2afab669f228072c1b0d510eae64 # v3.0.3
with:
files: assets/*.tgz
fail_on_unmatched_files: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish:
runs-on: ubuntu-24.04
needs: release
env:
DISABLE_MOLD: true
steps:
- name: Checkout Vector
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: ./.github/actions/setup
with:
rust: true
vdev: false
mold: false
- name: Publish to crates.io
working-directory: vdev
run: cargo publish
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}