Skip to content

Commit 8543dbd

Browse files
committed
ci: publish wasm to ghcr
ci: publish wasm to ghcr ci: publish wasm to ghcr ci: publish wasm to ghcr ci: publish wasm to ghcr ci(publish): use tag input only ci(publish): use tag input only ci(publish): use tag input only ci(publish): use tag input only ci(publish): use tag input only ci(publish): use tag input only ci(publish): use tag input only ci(publish): use tag input only ci(publish): use tag input only ci(publish): use tag input only ci(publish): use tag input only ci(publish): use tag input only ci(publish): use tag input only ci(publish): use tag input only
1 parent 1d3ad26 commit 8543dbd

1 file changed

Lines changed: 55 additions & 0 deletions

File tree

‎.github/workflows/publish.yml‎

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
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: export PLUGIN env
23+
run: |
24+
export PLUGIN=$(echo ${{ inputs.tag || github.ref_name }} | awk -F'/' '{print $1}')
25+
echo "PLUGIN=$PLUGIN" >> $GITHUB_ENV
26+
echo "TAG=$(echo ${{ inputs.tag || github.ref_name }} | awk -F'/' '{print $2}')" >> $GITHUB_ENV
27+
- if: ${{ env.PLUGIN == 'mongodb'}}
28+
run: |
29+
echo "PLUGIN=mongo" >> $GITHUB_ENV
30+
- name: Setup Fluent CI
31+
uses: fluentci-io/setup-fluentci@v5
32+
with:
33+
wasm: true
34+
plugin: rust
35+
args: |
36+
target_add wasm32-unknown-unknown
37+
build --release --target wasm32-unknown-unknown -p $PLUGIN
38+
env:
39+
GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40+
- name: Log in to the Container registry
41+
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
42+
with:
43+
registry: ghcr.io
44+
username: ${{ github.actor }}
45+
password: ${{ secrets.GITHUB_TOKEN }}
46+
- name: Cache wasm-to-oci
47+
uses: actions/cache@v4
48+
with:
49+
path: wasm-to-oci_linux-amd64.tar.gz
50+
key: wasm-to-oci-${{ runner.os }}
51+
- name: Publish to the Container registry
52+
run: |
53+
[ -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
54+
tar xvf wasm-to-oci_linux-amd64.tar.gz
55+
export NAME=$(echo $PLUGIN | sed 's/-/_/g') && ./wasm-to-oci push target/wasm32-unknown-unknown/release/$NAME.wasm ghcr.io/fluentci-io/$PLUGIN:$TAG-wasm

0 commit comments

Comments
 (0)