registry/.github/workflows/snapshot.yml
2025-04-08 22:48:31 +00:00

105 lines
2.6 KiB
YAML

name: Build snapshot
on:
workflow_call:
inputs:
cargo-dependencies:
description: "Cargo dependencies map"
type: string
default: "null"
ref:
description: "git ref to checkout to"
type: string
default: "master"
snapshot:
description: "Whether to publish snapshots"
type: boolean
default: true
outputs:
cargo-version:
description: "Cargo snapshot version"
value: ${{ jobs.snapshot.outputs.version }}
jobs:
snapshot:
name: "Build crate"
runs-on: builder
timeout-minutes: 60
outputs:
version: "${{ steps.snapshot.outputs.version }}"
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
with:
repository: fluencelabs/registry
ref: ${{ inputs.ref }}
- name: Setup Rust toolchain
uses: dsherret/rust-toolchain-file@v1
- name: Set dependencies
if: inputs.cargo-dependencies != 'null'
uses: fluencelabs/github-actions/cargo-set-dependency@main
with:
dependencies: ${{ inputs.cargo-dependencies }}
path: service/
- name: Setup marine
uses: fluencelabs/setup-marine@v1
with:
artifact-name: marine
- name: Setup fcli
uses: fluencelabs/setup-fluence@v1
with:
version: main
- name: Import secrets
if: inputs.snapshot == true
uses: hashicorp/vault-action@v2.8.1
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 node
uses: actions/setup-node@v3
with:
node-version: "18.20.8"
registry-url: "https://registry.npmjs.org"
cache-dependency-path: "aqua/package-lock.json"
cache: "npm"
- run: npm i
working-directory: aqua
- name: Install cargo-workspaces
uses: baptiste0928/cargo-install@v2.2.0
with:
crate: cargo-workspaces
- name: Generate snapshot version
id: version
uses: fluencelabs/github-actions/generate-snapshot-id@main
- name: Build distro
run: ./build.sh
- name: Publish crate snapshots
id: snapshot
uses: fluencelabs/github-actions/cargo-publish-snapshot@main
with:
id: ${{ steps.version.outputs.id }}
path: distro