-
Notifications
You must be signed in to change notification settings - Fork 0
90 lines (86 loc) · 2.81 KB
/
create-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
# Create a release from the latest tag
name: Create Release
permissions:
contents: write
on:
workflow_dispatch:
push:
branches: ["main"]
paths:
- "Cargo.toml"
jobs:
# Build and packages all the things
build-binaries:
if: |
contains(github.event.head_commit.message, 'chore: Release') == 'true' ||
contains(github.event.head_commit.message, 'chore: Bump') == 'true' ||
github.event_name == 'workflow_dispatch'
strategy:
matrix:
# For these target platforms
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
arch: x86_64
ext: deb
protoc-arch: linux-x86_64
# - target: x86_64-apple-darwin
# os: macos-latest
# arch: x86_64
# ext: pkg
# protoc-arch: osx-x86_64
# - target: aarch64-apple-darwin
# os: macos-latest
# config-file: fpm/osx.fpm
# arch: aarch64
# ext: pkg
# protoc-arch: osx-aarch_64
#- target: x86_64-pc-windows-msvc
# os: windows-latest
runs-on: ${{ matrix.os }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3
- name: Install libssl-dev
if: matrix.target == 'x86_64-unknown-linux-gnu'
run: sudo apt-get install libssl-dev pkg-config
- name: Install Rust
run: |
rustup update stable
rustup default stable
- name: Setup target
run: rustup target add ${{ matrix.target }}
- name: Run package script
run: |
cargo build --release --locked --target ${{ matrix.target }}
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: hermetic-driver-${{ matrix.target }}
path: target/${{ matrix.target }}/release/hermetic-driver
release:
needs: [build-binaries]
runs-on: ubuntu-latest
env:
# CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_TOKEN }}
# GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/download-artifact@v3
with:
path: artifacts
- name: check artifacts
run: |
ls artifacts/**/*
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- id: release
run: |
export TAG=$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[0].version' )
echo "Releasing "$TAG
cp artifacts/hermetic-driver-x86_64-unknown-linux-gnu/hermetic-driver artifacts/hermetic-driver-x86_64-linux
gh release create "v${TAG}" -n "Release of ${TAG}" -t "v${TAG}" --latest artifacts/hermetic-driver-x86_64-linux