-
Notifications
You must be signed in to change notification settings - Fork 0
93 lines (88 loc) · 3.32 KB
/
release.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
name: Release
permissions:
contents: write
pull-requests: write
attestations: write
id-token: write
on:
push:
tags:
- '**[0-9]+.[0-9]+.[0-9]+**'
jobs:
plan:
runs-on: ubuntu-latest
# Map a step output to a job output
outputs:
name: ${{ steps.name.outputs.name }}
version: ${{ steps.version.outputs.version }}
env:
TAG: ${{ github.ref_name }}
steps:
- name: Get plugin name
id: name
run: echo "name=${TAG%%-*}" >> $GITHUB_OUTPUT
- name: Get plugin version
id: version
run: echo "version=${TAG##*-}" >> $GITHUB_OUTPUT
build:
runs-on: ubuntu-latest
needs: plan
steps:
- name: GitHub Tag Name example
run: |
echo "Tag name from GITHUB_REF_NAME: $GITHUB_REF_NAME"
echo "Tag name from github.ref_name: ${{ github.ref_name }}"
- name: Checkout
uses: actions/checkout@v4
- uses: jcbhmr/setup-cargo-component@v1
- uses: Swatinem/rust-cache@v2
- name: Build
run: cargo component build --release -p ${{ needs.plan.outputs.name }}
- name: Attest
uses: actions/attest-build-provenance@v1
with:
subject-path: "target/wasm32-wasi/release/*.wasm"
- name: Archive built artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ needs.plan.outputs.name }}.wasm
if-no-files-found: error
path: |
target/wasm32-wasi/release/${{ needs.plan.outputs.name }}.wasm
release:
name: Create release
needs:
- plan
- build
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Fetch artifacts
uses: actions/download-artifact@v4
with:
name: ${{ needs.plan.outputs.name }}.wasm
path: release
- name: Generate checksum
working-directory: release
run: sha256sum ${{ needs.plan.outputs.name }}.wasm > ${{ needs.plan.outputs.name }}.wasm.sha256
- name: Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
name: ${{ needs.plan.outputs.name }} ${{ needs.plan.outputs.version }}
generate_release_notes: true
fail_on_unmatched_files: true
files: |
release/${{ needs.plan.outputs.name }}.wasm
release/${{ needs.plan.outputs.name }}.wasm.sha256
body: |
## Download lgc plugin ${{ needs.plan.outputs.name }} - ${{ needs.plan.outputs.version }}
| File | Checksum |
|--------|----------|
|[${{ needs.plan.outputs.name }}.wasm](https://github.com/LogCraftIO/logcraft-cli-plugins/releases/download/${{ github.ref_name }}/${{ needs.plan.outputs.name }}.wasm) | [checksum](https://github.com/LogCraftIO/logcraft-cli-plugins/releases/download/${{ github.ref_name }}/${{ needs.plan.outputs.name }}.wasm) |
## Verifying GitHub Artifact Attestations
The artifacts in this release have attestations generated with GitHub Artifact Attestations. These can be verified by using the [GitHub CLI](https://cli.github.com/manual/gh_attestation_verify):
```sh
gh attestation verify <file-path of downloaded artifact> --repo LogCraftIO/logcraft-cli-plugins
```