Skip to content

Commit 1d417a5

Browse files
committed
ci: publish wasm to ghcr
1 parent 81edfd7 commit 1d417a5

File tree

2 files changed

+53
-2
lines changed

2 files changed

+53
-2
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 2 deletions
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
@@ -22,8 +25,9 @@ jobs:
2225
args: |
2326
setup
2427
working-directory: example
28+
env:
29+
GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2530
- name: Show moon version
2631
run: |
27-
export PATH=${HOME}/.moon/bin:${PATH}
2832
type moon
2933
moon --version

.github/workflows/publish.yml

Lines changed: 47 additions & 0 deletions
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/moon.wasm ghcr.io/fluentci-io/moon:${{ inputs.tag || github.ref_name }}-wasm

0 commit comments

Comments
 (0)