Skip to content

Commit 8202e5a

Browse files
committed
Add GitHub Actions workflows for publishing to crates.io and creating releases
1 parent 1a5f14e commit 8202e5a

2 files changed

Lines changed: 86 additions & 0 deletions

File tree

.github/workflows/publish.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Publish to crates.io
2+
3+
on:
4+
push:
5+
tags: ["v*"] # Triggers when pushing tags starting with 'v'
6+
7+
jobs:
8+
publish:
9+
runs-on: ubuntu-latest
10+
# environment: release # Optional: for enhanced security
11+
permissions:
12+
id-token: write # Required for OIDC token exchange
13+
steps:
14+
- uses: actions/checkout@v7
15+
- uses: rust-lang/crates-io-auth-action@v1.0.5
16+
id: auth
17+
- run: cargo publish
18+
env:
19+
CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}

.github/workflows/release.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: GitHub Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
jobs:
9+
build:
10+
name: ${{ matrix.target }}
11+
strategy:
12+
matrix:
13+
include:
14+
- os: ubuntu-latest
15+
target: x86_64-unknown-linux-gnu
16+
binary: matrixfall
17+
- os: windows-latest
18+
target: x86_64-pc-windows-msvc
19+
binary: matrixfall.exe
20+
- os: macos-latest
21+
target: x86_64-apple-darwin
22+
binary: matrixfall
23+
24+
runs-on: ${{ matrix.os }}
25+
permissions:
26+
id-token: write
27+
attestations: write
28+
29+
steps:
30+
- uses: actions/checkout@v7
31+
32+
- name: Build
33+
run: cargo build --release
34+
35+
- name: Generate provenance
36+
uses: actions/attest-build-provenance@v4
37+
with:
38+
subject-path: target/release/${{ matrix.binary }}
39+
40+
- name: Upload artifact
41+
uses: actions/upload-artifact@v7.0.1
42+
with:
43+
name: ${{ matrix.target }}
44+
path: target/release/${{ matrix.binary }}
45+
46+
release:
47+
needs: build
48+
runs-on: ubuntu-latest
49+
permissions:
50+
contents: write
51+
52+
steps:
53+
- name: Download all artifacts
54+
uses: actions/download-artifact@v8.0.1
55+
with:
56+
path: artifacts
57+
58+
- name: Create Release
59+
env:
60+
GH_TOKEN: ${{ github.token }}
61+
run: |
62+
gh release create "${{ github.ref_name }}" \
63+
artifacts/x86_64-unknown-linux-gnu/matrixfall \
64+
artifacts/x86_64-pc-windows-msvc/matrixfall.exe \
65+
artifacts/x86_64-apple-darwin/matrixfall \
66+
--generate-notes \
67+
--title "${{ github.ref_name }}"

0 commit comments

Comments
 (0)