-
Notifications
You must be signed in to change notification settings - Fork 0
121 lines (117 loc) · 3.93 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
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
120
121
# 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: Brew install openssl
if: matrix.target == 'aarch64-apple-darwin'
run: brew install openssl
- 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
create-release:
name: Create Release
runs-on: ubuntu-latest
needs: [build-binaries]
outputs:
build_tag: ${{ steps.release.outputs.tag }}
env:
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
echo "tag=${TAG}" >> "$GITHUB_OUTPUT"
mkdir -p artifacts/output
cp artifacts/hermetic-driver-x86_64-unknown-linux-gnu/hermetic-driver \
artifacts/output/hermetic-driver-x86_64-linux
cp artifacts/hermetic-driver-aarch64-apple-darwin/hermetic-driver \
artifacts/output/hermetic-driver-aarch64-apple-darwin
current_branch=$(git rev-parse --abbrev-ref HEAD)
gh release create "v${TAG}" \
--generate-notes \
--target "$current_branch" \
--generate-notes \
--latest \
artifacts/output/hermetic-driver-x86_64-linux \
artifacts/output/hermetic-driver-aarch64-apple-darwin
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Public ECR
uses: docker/login-action@v2
with:
registry: public.ecr.aws
username: ${{ secrets.AWS_ACCESS_KEY_ID }}
password: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
env:
AWS_REGION: us-east-1
- name: Check
shell: bash
run: echo build_path "${{ steps.release.outputs.tag }}"
- name: Build and Publish
run: make BUILD_TAG=${{ steps.release.outputs.tag }} publish-hermetic-driver