2022-09-14 02:59:49 +00:00
|
|
|
name: Publish snapshot
|
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_call:
|
|
|
|
inputs:
|
|
|
|
fluence-js-version:
|
|
|
|
description: "@fluencejs/fluence version"
|
|
|
|
type: string
|
2022-12-01 15:46:44 +00:00
|
|
|
default: "null"
|
2022-12-02 08:15:26 +00:00
|
|
|
ref:
|
|
|
|
description: "git ref to checkout to"
|
|
|
|
type: string
|
|
|
|
default: "main"
|
2022-09-14 02:59:49 +00:00
|
|
|
outputs:
|
|
|
|
aqua-version:
|
|
|
|
description: "@fluencelabs/aqua version"
|
|
|
|
value: ${{ jobs.publish-snapshot.outputs.aqua-version }}
|
|
|
|
|
|
|
|
env:
|
|
|
|
FORCE_COLOR: true
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
compile:
|
2022-09-14 14:36:16 +00:00
|
|
|
name: "Compile"
|
2022-09-14 02:59:49 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout repository
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
repository: fluencelabs/aqua
|
2022-12-19 04:27:42 +00:00
|
|
|
ref: ${{ inputs.ref }}
|
2022-09-14 02:59:49 +00:00
|
|
|
|
2022-10-10 18:02:30 +00:00
|
|
|
- name: Generate version
|
|
|
|
id: version
|
|
|
|
run: |
|
|
|
|
SHA=${{ github.event.pull_request.head.sha }}
|
2022-10-31 14:51:37 +00:00
|
|
|
echo "sha=${SHA::7}" >> $GITHUB_OUTPUT
|
|
|
|
echo "branch=${GITHUB_HEAD_REF//[^a-zA-Z0-9-]/-}" >> $GITHUB_OUTPUT
|
2022-10-10 18:02:30 +00:00
|
|
|
|
2022-09-14 02:59:49 +00:00
|
|
|
- name: Cache Scala
|
|
|
|
uses: coursier/cache-action@v6
|
|
|
|
|
|
|
|
- name: Setup Scala
|
|
|
|
uses: coursier/setup-action@v1
|
|
|
|
|
|
|
|
- name: Compile aqua
|
2022-10-10 18:02:30 +00:00
|
|
|
env:
|
|
|
|
BUILD_NUMBER: ${{ steps.version.outputs.branch }}-${{ steps.version.outputs.sha }}-${{ github.run_number }}-${{ github.run_attempt }}
|
2022-09-14 02:59:49 +00:00
|
|
|
run: sbt "cliJS/fastOptJS"
|
|
|
|
|
|
|
|
- name: Upload compiled aqua
|
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
with:
|
|
|
|
name: aqua
|
|
|
|
path: cli/.js/target/scala-*/cli-fastopt.js
|
|
|
|
|
|
|
|
publish-snapshot:
|
2022-09-14 14:36:16 +00:00
|
|
|
name: "Publish snapshot"
|
2022-09-14 02:59:49 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
needs: compile
|
|
|
|
|
|
|
|
outputs:
|
2022-11-24 19:21:40 +00:00
|
|
|
aqua-version: "${{ steps.snapshot.outputs.version }}"
|
2022-09-14 02:59:49 +00:00
|
|
|
|
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
id-token: write
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout aqua
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
repository: fluencelabs/aqua
|
2022-12-19 04:27:42 +00:00
|
|
|
ref: ${{ inputs.ref }}
|
2022-09-14 02:59:49 +00:00
|
|
|
|
|
|
|
- name: Download compiled aqua
|
|
|
|
uses: actions/download-artifact@v3
|
|
|
|
with:
|
|
|
|
name: aqua
|
|
|
|
|
|
|
|
- run: mv scala-*/cli-fastopt.js npm/aqua.js
|
|
|
|
|
|
|
|
- name: Import secrets
|
2022-11-24 19:21:40 +00:00
|
|
|
uses: hashicorp/vault-action@v2.4.3
|
2022-09-14 02:59:49 +00:00
|
|
|
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: "npm/package-lock.json"
|
|
|
|
cache: "npm"
|
|
|
|
|
2022-09-14 14:36:16 +00:00
|
|
|
- run: npm i
|
|
|
|
working-directory: npm
|
|
|
|
|
2022-09-14 02:59:49 +00:00
|
|
|
- name: Set fluence-js version from branch
|
2022-12-01 15:46:44 +00:00
|
|
|
if: inputs.fluence-js-version != 'null'
|
2022-09-14 02:59:49 +00:00
|
|
|
working-directory: npm
|
2022-10-10 18:02:30 +00:00
|
|
|
run: npm i --save -E @fluencelabs/fluence@${{ inputs.fluence-js-version }}
|
2022-09-14 02:59:49 +00:00
|
|
|
|
|
|
|
- run: npm run build
|
|
|
|
working-directory: npm
|
|
|
|
|
2022-11-24 19:21:40 +00:00
|
|
|
- name: Generate snapshot version
|
2022-09-14 02:59:49 +00:00
|
|
|
id: version
|
2022-11-24 19:21:40 +00:00
|
|
|
uses: fluencelabs/github-actions/generate-snapshot-id@main
|
2022-09-14 02:59:49 +00:00
|
|
|
|
2022-11-24 19:21:40 +00:00
|
|
|
- name: Publish snapshot
|
|
|
|
id: snapshot
|
|
|
|
uses: fluencelabs/github-actions/npm-publish-snapshot@main
|
|
|
|
with:
|
|
|
|
working-directory: npm
|
|
|
|
id: ${{ steps.version.outputs.id }}
|