-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: aish-where-ya <[email protected]>
- Loading branch information
1 parent
c1298dc
commit f17e38a
Showing
2 changed files
with
107 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Build and test | ||
on: | ||
pull_request: | ||
branches: [main] | ||
paths: | ||
- "xkcdgenerator/**" | ||
|
||
env: | ||
working-directory: "./xkcdgenerator" | ||
jobs: | ||
build_and_test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Add wasm32-unknown-unknown | ||
run: rustup target add wasm32-unknown-unknown | ||
- name: Check formatting | ||
run: cargo fmt -- --check | ||
shell: bash | ||
working-directory: ${{ env.working-directory }} | ||
- name: Build actor | ||
run: cargo build | ||
working-directory: ${{ env.working-directory }} | ||
- name: Check lints with clippy | ||
run: | | ||
rustup component add clippy | ||
cargo clippy | ||
working-directory: ${{ env.working-directory }} | ||
# Once you've written unit tests for your actor, you can uncomment | ||
# the two lines below to automatically run tests | ||
# - name: Test actor | ||
# run: cargo test --target x86_64-unknown-linux-gnu -- --nocapture | ||
# working-directory: ${{ env.working-directory }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
name: Release XKCDGenerator to AzureCR | ||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: [main] | ||
paths: | ||
- "xkcdgenerator/**" | ||
tags: | ||
- "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_XKCDGENERATOR_KEY }} | ||
working-directory: "./xkcdgenerator" | ||
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 }} | ||
# Once you've written unit tests for your actor, you can uncomment | ||
# the two lines below to automatically run tests | ||
# - name: Test actor | ||
# run: cargo test --target x86_64-unknown-linux-gnu -- --nocapture | ||
- name: Build and sign wasmCloud actor | ||
env: | ||
WASH_ISSUER_KEY: ${{ env.WASH_ISSUER_KEY }} | ||
WASH_SUBJECT_KEY: ${{ env.WASH_SUBJECT_KEY }} | ||
run: wash build | ||
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 }}/build/*_s.wasm | ||
|
||
artifact_release: | ||
needs: build_signed_actor | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: wasmcloud/common-actions/install-wash@main | ||
- name: Download signed actor | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: wasmcloud-actor | ||
path: ${{ env.working-directory }}/build | ||
- 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 }} | ||
- 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 }} | ||
- name: Determine actor version (main) | ||
if: ${{ !startswith(github.ref, 'refs/tags/') }} | ||
run: | | ||
echo "actor-version=latest" >> $GITHUB_ENV | ||
working-directory: ${{ env.working-directory }} | ||
- name: Push actor to AzureCR | ||
uses: wasmcloud/common-actions/oci-artifact-release@main | ||
with: | ||
artifact-path: ${{ env.working-directory }}/build/${{ env.actor-name }}_s.wasm | ||
oci-url: ${{ secrets.AZURECR_PUSH_URL }} | ||
oci-repository: ${{ env.actor-name }} | ||
oci-version: ${{ env.actor-version }} | ||
oci-username: ${{ secrets.COSMONIC_AZURECR_PUSH_USER }} | ||
oci-password: ${{ secrets.COSMONIC_AZURECR_PUSH_PASSWORD }} |