Skip to content

Commit 43a0091

Browse files
authored
fix: Release binaries and enable nightly workflows to create binary artifacts and images (#313)
1 parent b6301aa commit 43a0091

File tree

2 files changed

+118
-4
lines changed

2 files changed

+118
-4
lines changed

.github/workflows/release-bins.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@ on:
1515
required: true
1616
jobs:
1717
build:
18+
# for list of arch `rustup target list | grep -iE 'apple|linux'`
19+
20+
# TODO: Change https://github.com/actions/runner-images/issues/12520 `macos-latest` to `macos-15` when available
1821
name: Build binaries
1922
environment: release
20-
env:
21-
TAG: ${{ inputs.tag || github.event.inputs.tag }}
2223
outputs:
2324
release_tag: ${{ env.TAG }}
2425
strategy:
@@ -33,6 +34,9 @@ jobs:
3334
- arch: aarch64-apple-darwin
3435
platform: macos-latest
3536
runs-on: ${{ matrix.platform }}
37+
env:
38+
TAG: ${{ inputs.tag || github.event.inputs.tag }}
39+
RUSTUP_TOOLCHAIN: stable-${{ matrix.arch }}
3640
steps:
3741
- name: Get github app token
3842
uses: actions/create-github-app-token@3ff1caaa28b64c9cc276ce0a02e2ff584f3900c5 # v2.0.2
@@ -98,9 +102,9 @@ jobs:
98102
- name: Binaries attestation
99103
uses: actions/attest-build-provenance@d3b713ade6128010830a9be91a036ed11e065550 # main
100104
with:
101-
subject-path: artifacts/**/openzeppelin-monitor
105+
subject-path: artifacts/**/openzeppelin-monitor*.tar.gz
102106
github-token: ${{ steps.gh-app-token.outputs.token }}
103-
- name: Update release please artifacts
107+
- name: Update released binaries artifacts
104108
uses: softprops/action-gh-release@ab50eebb6488051c6788d97fa95232267c6a4e23 # main
105109
with:
106110
tag_name: ${{ env.TAG }}

.github/workflows/test-bins.yml

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
---
2+
name: Test binaries
3+
on:
4+
workflow_dispatch: {}
5+
# Run nightly on the main branch
6+
schedule:
7+
- cron: 0 0 * * * # Every day at midnight UTC
8+
# run concurrency group for the workflow
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
12+
permissions:
13+
contents: write
14+
pull-requests: write
15+
attestations: write
16+
packages: write
17+
id-token: write
18+
jobs:
19+
build:
20+
name: Build binaries
21+
# for list of arch `rustup target list | grep -iE 'apple|linux'`
22+
23+
# TODO: Change https://github.com/actions/runner-images/issues/12520 `macos-latest` to `macos-15` when available
24+
strategy:
25+
matrix:
26+
include:
27+
- arch: x86_64-unknown-linux-gnu
28+
platform: ubuntu-22.04
29+
- arch: aarch64-unknown-linux-gnu
30+
platform: ubuntu-22.04-arm
31+
- arch: x86_64-apple-darwin
32+
platform: macos-latest
33+
- arch: aarch64-apple-darwin
34+
platform: macos-latest
35+
runs-on: ${{ matrix.platform }}
36+
env:
37+
RUSTUP_TOOLCHAIN: stable-${{ matrix.arch }}
38+
steps:
39+
- name: Get github app token
40+
uses: actions/create-github-app-token@3ff1caaa28b64c9cc276ce0a02e2ff584f3900c5 # v2.0.2
41+
id: gh-app-token
42+
with:
43+
app-id: ${{ vars.GH_APP_ID }}
44+
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
45+
- name: Checkout sources
46+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
47+
with:
48+
token: ${{ steps.gh-app-token.outputs.token }}
49+
- name: Install Rust
50+
uses: dtolnay/rust-toolchain@fcf085fcb4b4b8f63f96906cd713eb52181b5ea4 # stable
51+
with:
52+
toolchain: stable
53+
target: ${{ matrix.arch }}
54+
- name: Build monitor for ${{ matrix.arch }}
55+
run: |
56+
cargo build --bin openzeppelin-monitor --release --target ${{ matrix.arch }}
57+
- name: Pack monitor
58+
run: |
59+
tar -C ./target/${{ matrix.arch }}/release -czf \
60+
openzeppelin-monitor-${{ github.sha }}-${{ matrix.arch }}.tar.gz \
61+
openzeppelin-monitor
62+
- name: Upload artifact
63+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
64+
with:
65+
name: openzeppelin-monitor-${{ github.sha }}-${{ matrix.arch }}
66+
path: |
67+
openzeppelin-monitor-${{ github.sha }}-${{ matrix.arch }}.tar.gz
68+
./target/${{ matrix.arch }}/release/openzeppelin-monitor
69+
retention-days: 1
70+
upload-binaries:
71+
name: Upload binaries
72+
permissions:
73+
contents: write
74+
pull-requests: write
75+
attestations: write
76+
packages: write
77+
id-token: write
78+
needs: build
79+
runs-on: ubuntu-latest
80+
steps:
81+
- name: Get github app token
82+
uses: actions/create-github-app-token@3ff1caaa28b64c9cc276ce0a02e2ff584f3900c5 # v2.0.2
83+
id: gh-app-token
84+
with:
85+
app-id: ${{ vars.GH_APP_ID }}
86+
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
87+
- name: Checkout sources
88+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
89+
with:
90+
token: ${{ steps.gh-app-token.outputs.token }}
91+
- name: Download artifacts
92+
uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.2.1
93+
with:
94+
pattern: openzeppelin-monitor-*
95+
path: artifacts
96+
- name: Binaries attestation
97+
uses: actions/attest-build-provenance@d3b713ade6128010830a9be91a036ed11e065550 # main
98+
with:
99+
subject-path: artifacts/**/openzeppelin-monitor*.tar.gz
100+
github-token: ${{ steps.gh-app-token.outputs.token }}
101+
# Validate the artifacts path
102+
- name: Validate artifacts
103+
run: |-
104+
# Check if the artifacts exist
105+
if ls artifacts/*/openzeppelin-monitor-*.tar.gz >/dev/null 2>&1; then
106+
echo "Artifacts found"
107+
else
108+
echo "No artifacts found"
109+
exit 1
110+
fi

0 commit comments

Comments
 (0)