chore: add http-file-server example #34
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release KVCounter to GHCR | |
on: | |
workflow_dispatch: | |
push: | |
branches: [main] | |
paths: | |
- "kvcounter/**" | |
tags: | |
- "kvcounter-v*" | |
env: | |
# For the release action, you'll have to set the following variables | |
WASH_ISSUER_KEY: ${{ secrets.COSMONIC_ACCOUNT_OFFICIAL }} | |
WASH_SUBJECT_KEY: ${{ secrets.AWESOME_COSMONIC_KVCOUNTER_KEY }} | |
working-directory: "./kvcounter" | |
jobs: | |
build_signed_actor: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: wasmcloud/common-actions/install-wash@main | |
- name: Add wasm32-unknown-unknown | |
run: rustup target add wasm32-unknown-unknown | |
working-directory: ${{ env.working-directory }}/rust | |
- name: Build and sign wasmCloud actor | |
env: | |
WASH_ISSUER_KEY: ${{ env.WASH_ISSUER_KEY }} | |
WASH_SUBJECT_KEY: ${{ env.WASH_SUBJECT_KEY }} | |
run: | | |
wash new actor --path rust kvcounter | |
wash build -p kvcounter | |
rm -rf kvcounter/target | |
tar -cvf kvcounter.tar kvcounter | |
rm -rf kvcounter | |
shell: bash | |
working-directory: ${{ env.working-directory }} | |
- name: Upload signed actor to GH Actions | |
uses: actions/upload-artifact@v3 | |
with: | |
name: wasmcloud-actor | |
path: ${{ env.working-directory }}/kvcounter.tar | |
artifact_release: | |
needs: build_signed_actor | |
runs-on: ubuntu-latest | |
steps: | |
- uses: wasmcloud/common-actions/install-wash@main | |
- name: Download signed actor | |
uses: actions/download-artifact@v3 | |
with: | |
name: wasmcloud-actor | |
path: ${{ env.working-directory }} | |
- name: Extract files from tar file | |
run: tar -xvf kvcounter.tar | |
shell: bash | |
working-directory: ${{ env.working-directory }} | |
- name: Determine actor name | |
run: | | |
echo "actor-name=$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[].name')" >> $GITHUB_ENV | |
working-directory: ${{ env.working-directory }}/kvcounter | |
- name: Determine actor version | |
if: startswith(github.ref, 'refs/tags/') # Only run on tag push | |
run: | | |
echo "actor-version=$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[].version')" >> $GITHUB_ENV | |
working-directory: ${{ env.working-directory }}/kvcounter | |
- name: Determine actor version (main) | |
if: ${{ !startswith(github.ref, 'refs/tags/') }} | |
run: | | |
echo "actor-version=latest" >> $GITHUB_ENV | |
working-directory: ${{ env.working-directory }}/kvcounter | |
- name: Push actor to GHCR | |
uses: wasmcloud/common-actions/oci-artifact-release@main | |
with: | |
artifact-path: ${{ env.working-directory }}/kvcounter/build/${{ env.actor-name }}_s.wasm | |
oci-url: ${{ secrets.GHCR_PUSH_URL }} | |
oci-repository: ${{ env.actor-name }} | |
oci-version: ${{ env.actor-version }} | |
oci-username: ${{ github.actor }} | |
oci-password: ${{ secrets.GITHUB_TOKEN }} |