-
Notifications
You must be signed in to change notification settings - Fork 36
118 lines (109 loc) · 3.91 KB
/
CreateRelease.yml
File metadata and controls
118 lines (109 loc) · 3.91 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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Create a Release
on:
workflow_dispatch:
push:
branches: [ release/**, main ]
permissions:
contents: write
packages: write
id-token: write # Required for crates.io trusted publishing
jobs:
benchmarks:
uses: ./.github/workflows/Benchmarks.yml
publish:
# see https://github.com/orgs/community/discussions/26286#discussioncomment-3251208 for why we need to check the ref
if: ${{ contains(github.ref, 'refs/heads/release/') }} || ${{ github.ref=='refs/heads/main' }}
needs: [ benchmarks ]
runs-on: ubuntu-latest
env:
PLATFORM: x64
steps:
- name: Set Debug Configuration
if: ${{ github.ref=='refs/heads/main' }}
run: echo "CONFIG=debug" >> $GITHUB_ENV
- name: Set Release Configuration
if: ${{ contains(github.ref, 'refs/heads/release/') }}
run: echo "CONFIG=release" >> $GITHUB_ENV
- uses: actions/checkout@v5
with:
fetch-depth: 0
# Ensures just is installed using setup wokflow to ensure just version consistency
- name: Hyperlight setup
uses: hyperlight-dev/ci-setup-workflow@v1.8.0
with:
rust-toolchain: "1.89"
- name: Set HYPERLIGHTWASM_VERSION
run: |
git fetch --tags
version=$(echo "${{ github.ref }}" | sed -E 's#refs/heads/release/v##')
echo "HYPERLIGHTWASM_VERSION=$version" >> $GITHUB_ENV
echo "HYPERLIGHTWASM_VERSION=$version"
if: ${{ contains(github.ref, 'refs/heads/release/') }}
shell: bash
- name: Download Wasm Modules
uses: actions/download-artifact@v5
with:
name: guest-modules
path: ${{ env.PLATFORM }}/${{ env.CONFIG }}
- name: Build rust wasm modules
run: just build-rust-wasm-examples ${{ env.CONFIG }}
shell: bash
- name: Download all benchmarks
uses: actions/download-artifact@v5
with:
pattern: benchmarks_*
- name: Archive benchmarks
shell: bash
run: |
for BENCHMARK in benchmarks_*; do
tar -zcvf $BENCHMARK.tar.gz $BENCHMARK
done
- name: Create pre-release
if: ${{ github.ref=='refs/heads/main' }}
run: |
echo "PWD: $PWD"
ls -alR
gh release delete dev-latest -y --cleanup-tag || true
gh release create dev-latest -t "Latest Development Build From Dev Branch" --latest=false -p \
benchmarks_*.tar.gz
env:
GH_TOKEN: ${{ github.token }}
shell: bash
- name: Create Release
if: ${{ contains(github.ref, 'refs/heads/release/') }}
run: |
echo "PWD: $PWD"
ls -alR
gh release create v${{ env.HYPERLIGHTWASM_VERSION }} -t "Release v${{ env.HYPERLIGHTWASM_VERSION }}" --generate-notes \
benchmarks_*.tar.gz
env:
GH_TOKEN: ${{ github.token }}
shell: bash
- name: Authenticate with crates.io
if: ${{ contains(github.ref, 'refs/heads/release/') }}
uses: rust-lang/crates-io-auth-action@v1
id: crates-io-auth
- name: Publish to crates.io
if: ${{ contains(github.ref, 'refs/heads/release/') }}
run: |
set -euxo pipefail
publish_if_needed() {
local crate=$1
local version=$HYPERLIGHTWASM_VERSION
local status_code
status_code=$(curl -s -o /dev/null -w "%{http_code}" "https://crates.io/api/v1/crates/$crate/$version")
if [ "$status_code" = "200" ]; then
echo "✅ $crate@$version already published, skipping."
else
echo "🚀 Publishing $crate@$version"
cargo +1.92 publish -p "$crate"
fi
}
publish_if_needed hyperlight-wasm-macro
publish_if_needed hyperlight-wasm-runtime
publish_if_needed hyperlight-wasm-aot
publish_if_needed hyperlight-wasm
env:
CARGO_REGISTRY_TOKEN: ${{ steps.crates-io-auth.outputs.token }}
shell: bash