Skip to content

Commit d27f70e

Browse files
committed
ci: publish wasm to ghcr
1 parent 548b91e commit d27f70e

File tree

2 files changed

+51
-1
lines changed

2 files changed

+51
-1
lines changed

.github/workflows/ci.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ on:
55
- main
66
jobs:
77
example:
8-
runs-on: ubuntu-latest
8+
strategy:
9+
matrix:
10+
os: [ubuntu-latest, macos-latest]
11+
runs-on: ${{ matrix.os }}
912
steps:
1013
- uses: actions/checkout@v3
1114
- name: Setup example

.github/workflows/publish.yml

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: "Publish to Github Packages"
2+
on:
3+
push:
4+
tags:
5+
- "*"
6+
workflow_dispatch:
7+
inputs:
8+
tag:
9+
description: "The existing tag to publish"
10+
type: "string"
11+
required: true
12+
jobs:
13+
publish-wasm:
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: read
17+
packages: write
18+
steps:
19+
- uses: actions/checkout@v3
20+
with:
21+
ref: ${{ inputs.tag || github.ref_name }}
22+
- name: Setup Fluent CI
23+
uses: fluentci-io/setup-fluentci@v5
24+
with:
25+
wasm: true
26+
plugin: rust
27+
args: |
28+
target_add wasm32-unknown-unknown
29+
build --release --target wasm32-unknown-unknown
30+
env:
31+
GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32+
- name: Log in to the Container registry
33+
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
34+
with:
35+
registry: ghcr.io
36+
username: ${{ github.actor }}
37+
password: ${{ secrets.GITHUB_TOKEN }}
38+
- name: Cache wasm-to-oci
39+
uses: actions/cache@v4
40+
with:
41+
path: wasm-to-oci_linux-amd64.tar.gz
42+
key: wasm-to-oci-${{ runner.os }}
43+
- name: Publish to the Container registry
44+
run: |
45+
[ -f wasm-to-oci_linux-amd64.tar.gz ] || pkgx wget https://github.com/fluentci-io/wasm-to-oci/releases/download/v0.1.2/wasm-to-oci_linux-amd64.tar.gz
46+
tar xvf wasm-to-oci_linux-amd64.tar.gz
47+
./wasm-to-oci push target/wasm32-unknown-unknown/release/trufflehog.wasm ghcr.io/fluentci-io/trufflehog:${{ inputs.tag || github.ref_name }}-wasm

0 commit comments

Comments
 (0)