mirror of
https://github.com/fluencelabs/aquavm
synced 2025-03-28 02:11:03 +00:00
239 lines
7.3 KiB
YAML
239 lines
7.3 KiB
YAML
name: Publish snapshots
|
|
|
|
on:
|
|
workflow_call:
|
|
outputs:
|
|
avm-version:
|
|
description: "@fluencelabs/avm version"
|
|
value: ${{ jobs.publish-avm.outputs.version }}
|
|
air-interpreter-wasm-version:
|
|
description: "air-interpreter-wasm version"
|
|
value: ${{ jobs.publish-interpreter.outputs.version }}
|
|
|
|
env:
|
|
FORCE_COLOR: true
|
|
|
|
jobs:
|
|
wasm:
|
|
name: "Build air-interpreter-wasm"
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout AquaVM
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Setup Rust toolchain
|
|
uses: actions-rust-lang/setup-rust-toolchain@v1
|
|
|
|
- name: Install marine
|
|
uses: baptiste0928/cargo-install@v1
|
|
with:
|
|
crate: marine
|
|
|
|
- name: Build air-interpreter-wasm binary
|
|
run: marine build --release --features marine
|
|
working-directory: air-interpreter
|
|
|
|
- name: Upload air-interpreter-wasm binary
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: air-interpreter-wasm
|
|
path: target/wasm32-wasi/release/air_interpreter_server.wasm
|
|
|
|
publish-avm:
|
|
name: "Publish avm snapshot"
|
|
runs-on: ubuntu-latest
|
|
|
|
needs: wasm
|
|
|
|
outputs:
|
|
version: "${{ steps.build.outputs.version }}"
|
|
|
|
permissions:
|
|
contents: read
|
|
pull-requests: write
|
|
id-token: write
|
|
|
|
steps:
|
|
- name: Checkout AquaVM
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Download air-interpreter-wasm binary
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
name: air-interpreter-wasm
|
|
path: avm/client/dist/
|
|
|
|
- run: mv air_interpreter_server.wasm avm.wasm
|
|
working-directory: avm/client/dist
|
|
|
|
- name: Import secrets
|
|
uses: hashicorp/vault-action@v2.4.2
|
|
with:
|
|
url: https://vault.fluence.dev
|
|
path: jwt/github
|
|
role: ci
|
|
method: jwt
|
|
jwtGithubAudience: "https://github.com/fluencelabs"
|
|
jwtTtl: 300
|
|
exportToken: false
|
|
secrets: |
|
|
kv/npm-registry/basicauth/ci token | NODE_AUTH_TOKEN
|
|
|
|
- name: Setup node with self-hosted npm registry
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: "16"
|
|
registry-url: "https://npm.fluence.dev"
|
|
cache-dependency-path: avm/client/package-lock.json
|
|
cache: "npm"
|
|
|
|
- run: npm i
|
|
working-directory: avm/client
|
|
|
|
- run: npm run build
|
|
working-directory: avm/client
|
|
|
|
- name: Generate package version
|
|
id: version
|
|
run: |
|
|
SHA=${{ github.event.pull_request.head.sha }}
|
|
echo "::set-output name=sha::${SHA::7}"
|
|
echo "::set-output name=branch::${GITHUB_HEAD_REF//[^a-zA-Z0-9-]/-}"
|
|
|
|
- name: Set package version
|
|
id: build
|
|
env:
|
|
BRANCH: ${{ steps.version.outputs.branch }}
|
|
SHA: ${{ steps.version.outputs.sha }}
|
|
RUN: ${{ github.run_number }}
|
|
ATTEMPT: ${{ github.run_attempt }}
|
|
working-directory: avm/client
|
|
run: |
|
|
echo "::set-output name=version::$(\
|
|
npm version prerelease \
|
|
--no-git-tag-version \
|
|
--preid ${{ env.BRANCH }}-${{ env.SHA }}-${{ env.RUN }}-${{ env.ATTEMPT }})"
|
|
|
|
- name: Publish to self-hosted npm repo
|
|
working-directory: avm/client
|
|
run: npm publish --tag snapshot --registry https://npm.fluence.dev
|
|
|
|
- name: Find comment in PR
|
|
uses: peter-evans/find-comment@v1
|
|
id: comment
|
|
with:
|
|
issue-number: "${{ github.event.pull_request.number }}"
|
|
comment-author: github-actions[bot]
|
|
body-includes: "## AVM version is"
|
|
|
|
- name: Update comment in PR
|
|
uses: peter-evans/create-or-update-comment@v1
|
|
env:
|
|
AVM_VERSION: ${{ steps.build.outputs.version }}
|
|
with:
|
|
comment-id: "${{ steps.comment.outputs.comment-id }}"
|
|
issue-number: "${{ github.event.pull_request.number }}"
|
|
edit-mode: replace
|
|
body: |
|
|
## AVM version is [${{ env.AVM_VERSION }}](https://npm.fluence.dev/-/web/detail/@fluencelabs/avm/v/${{ env.AVM_VERSION }})
|
|
To install it run:
|
|
```shell
|
|
npm login --registry https://npm.fluence.dev
|
|
npm i @fluencelabs/avm@${{ env.AVM_VERSION }} --registry=https://npm.fluence.dev
|
|
```
|
|
|
|
publish-interpreter:
|
|
name: "Publish air-interpreter-wasm snapshot"
|
|
runs-on: ubuntu-latest
|
|
|
|
needs: wasm
|
|
|
|
outputs:
|
|
version: "${{ steps.build.outputs.version }}"
|
|
|
|
permissions:
|
|
contents: read
|
|
pull-requests: write
|
|
id-token: write
|
|
|
|
steps:
|
|
- name: Checkout AquaVM
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Download air-interpreter-wasm binary
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
name: air-interpreter-wasm
|
|
|
|
- run: mv air_interpreter_server.wasm crates/interpreter-wasm/
|
|
|
|
- name: Import secrets
|
|
uses: hashicorp/vault-action@v2.4.2
|
|
with:
|
|
url: https://vault.fluence.dev
|
|
path: jwt/github
|
|
role: ci
|
|
method: jwt
|
|
jwtGithubAudience: "https://github.com/fluencelabs"
|
|
jwtTtl: 300
|
|
exportToken: false
|
|
secrets: |
|
|
kv/cargo-registry/users/ci token | CARGO_REGISTRIES_FLUENCE_TOKEN
|
|
|
|
- name: Setup Rust toolchain
|
|
uses: actions-rust-lang/setup-rust-toolchain@v1
|
|
|
|
- name: Install cargo-edit
|
|
uses: baptiste0928/cargo-install@v1
|
|
with:
|
|
crate: cargo-edit
|
|
|
|
- name: Generate package version
|
|
id: version
|
|
run: |
|
|
SHA=${{ github.event.pull_request.head.sha }}
|
|
echo "::set-output name=sha::${SHA::7}"
|
|
echo "::set-output name=branch::${GITHUB_HEAD_REF//[^a-zA-Z0-9-]/-}"
|
|
|
|
- name: Set package version
|
|
id: build
|
|
env:
|
|
BRANCH: ${{ steps.version.outputs.branch }}
|
|
SHA: ${{ steps.version.outputs.sha }}
|
|
RUN: ${{ github.run_number }}
|
|
ATTEMPT: ${{ github.run_attempt }}
|
|
working-directory: crates/interpreter-wasm
|
|
run: |
|
|
cargo set-version --bump alpha
|
|
cargo set-version "$(cargo read-manifest | jq -r .version)-${{ env.BRANCH }}-${{ env.SHA }}-${{ env.RUN }}-${{ env.ATTEMPT }}"
|
|
|
|
echo "::set-output name=version::$(cargo read-manifest | jq -r .version)"
|
|
|
|
- name: Publish to self-hosted cargo registry
|
|
working-directory: crates/interpreter-wasm
|
|
run: cargo publish --registry fluence --allow-dirty
|
|
|
|
- name: Find comment in PR
|
|
uses: peter-evans/find-comment@v1
|
|
id: comment
|
|
with:
|
|
issue-number: "${{ github.event.pull_request.number }}"
|
|
comment-author: github-actions[bot]
|
|
body-includes: "## air-interpreter-wasm version is"
|
|
|
|
- name: Update comment in PR
|
|
uses: peter-evans/create-or-update-comment@v1
|
|
env:
|
|
VERSION: ${{ steps.build.outputs.version }}
|
|
with:
|
|
comment-id: "${{ steps.comment.outputs.comment-id }}"
|
|
issue-number: "${{ github.event.pull_request.number }}"
|
|
edit-mode: replace
|
|
body: |
|
|
## air-interpreter-wasm version is [${{ env.VERSION }}](https://crates.fluence.dev/#/crate?name=air-interpreter-wasm&version=${{ env.VERSION }})
|
|
To install it run:
|
|
```shell
|
|
cargo add air-interpreter-wasm@${{ env.VERSION }} --registry fluence
|
|
```
|