forked from wasmCloud/examples
-
Notifications
You must be signed in to change notification settings - Fork 0
102 lines (90 loc) · 3.34 KB
/
animal-image-downloader.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
name: ANIMAL IMAGE DOWNLOADER
on:
push:
branches: [main]
paths:
- "actor/animal-image-downloader/**"
tags:
- "animal-image-downloader-v*"
pull_request:
branches: [main]
paths:
- "actor/animal-image-downloader/**"
env:
CARGO_TERM_COLOR: always
working-directory: ./actor/animal-image-downloader
WASH_ISSUER_KEY: ${{ secrets.WASMCLOUD_ACCOUNT_OFFICIAL }}
WASH_SUBJECT_KEY: ${{ secrets.WASMCLOUD_ANIMAL_IMAGE_DOWNLOADER }}
jobs:
rust_check:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
# If your integration tests require nats or redis, run them here
- name: Add wasm32-unknown-unknown
run: rustup target add wasm32-unknown-unknown
- id: rust-check-action
uses: wasmcloud/common-actions/rust-check@main
with:
working-directory: ${{ env.working-directory }}
# The `--doc` is required for wasm, as cargo cannot execute wasm tests by default
test-options: "--verbose --doc"
build_artifact:
needs: rust_check
if: startswith(github.ref, 'refs/tags/') # Only run on tag push
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- uses: wasmcloud/common-actions/install-wash@main
- name: Add wasm32-unknown-unknown
run: rustup target add wasm32-unknown-unknown
- name: Build wasmcloud actor
run: wash build
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/*.wasm
github_release:
if: startswith(github.ref, 'refs/tags/') # Only run on tag push
needs: build_artifact
runs-on: ubuntu-20.04
steps:
- name: Download signed actor
uses: actions/download-artifact@v3
with:
name: wasmcloud-actor
path: ${{ env.working-directory }}/build
- name: Release
uses: softprops/action-gh-release@v1
with:
files: ${{ env.working-directory }}/build/*.wasm
token: ${{ secrets.GITHUB_TOKEN }}
prerelease: true
draft: false
artifact_release:
needs: build_artifact
if: startswith(github.ref, 'refs/tags/') # Only run on tag push
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- name: Download signed actor
uses: actions/download-artifact@v3
with:
name: wasmcloud-actor
path: ${{ env.working-directory }}/build
- name: Determine artifact metadata
run: |
echo "oci-repository=$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[].name')" >> $GITHUB_ENV
echo "oci-version=$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[].version')" >> $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/animal_image_downloader_s.wasm
oci-url: ${{ secrets.AZURECR_PUSH_URL }}
oci-repository: ${{ env.oci-repository }}
oci-version: ${{ env.oci-version }}
oci-username: ${{ secrets.AZURECR_PUSH_USER }}
oci-password: ${{ secrets.AZURECR_PUSH_PASSWORD }}