Skip to content

Commit

Permalink
ci: publish wasm to ghcr
Browse files Browse the repository at this point in the history
ci: publish wasm to ghcr

ci: publish wasm to ghcr
  • Loading branch information
tsirysndr committed Jul 25, 2024
1 parent 4f36098 commit f30153f
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 1 deletion.
10 changes: 9 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ on:
- main
jobs:
example:
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Setup example
Expand All @@ -14,6 +17,9 @@ jobs:
cp -r src example/.fluentci
cp Cargo.toml example/.fluentci
cp Cargo.lock example/.fluentci
- name: Uninstall packer
if: matrix.os == 'ubuntu-latest'
run: |
sudo rm /usr/local/bin/packer
- name: Setup Fluent CI CLI
uses: fluentci-io/setup-fluentci@v5
Expand All @@ -23,6 +29,8 @@ jobs:
args: |
setup
working-directory: example
env:
GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Show packer version
run: |
type packer
Expand Down
47 changes: 47 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: "Publish to Github Packages"
on:
push:
tags:
- "*"
workflow_dispatch:
inputs:
tag:
description: "The existing tag to publish"
type: "string"
required: true
jobs:
publish-wasm:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
with:
ref: ${{ inputs.tag || github.ref_name }}
- name: Setup Fluent CI
uses: fluentci-io/setup-fluentci@v5
with:
wasm: true
plugin: rust
args: |
target_add wasm32-unknown-unknown
build --release --target wasm32-unknown-unknown
env:
GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Log in to the Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Cache wasm-to-oci
uses: actions/cache@v4
with:
path: wasm-to-oci_linux-amd64.tar.gz
key: wasm-to-oci-${{ runner.os }}
- name: Publish to the Container registry
run: |
[ -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
tar xvf wasm-to-oci_linux-amd64.tar.gz
./wasm-to-oci push target/wasm32-unknown-unknown/release/packer.wasm ghcr.io/fluentci-io/packer:${{ inputs.tag || github.ref_name }}-wasm

0 comments on commit f30153f

Please sign in to comment.