2022-09-14 02:59:49 +00:00
|
|
|
name: Publish snapshot
|
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_call:
|
|
|
|
inputs:
|
|
|
|
fluence-js-version:
|
|
|
|
description: "@fluencejs/fluence version"
|
|
|
|
type: string
|
|
|
|
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
|
|
|
|
|
|
|
|
- name: Cache Scala
|
|
|
|
uses: coursier/cache-action@v6
|
|
|
|
|
|
|
|
- name: Setup Scala
|
|
|
|
uses: coursier/setup-action@v1
|
|
|
|
|
|
|
|
- name: Compile aqua
|
|
|
|
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:
|
|
|
|
aqua-version: "${{ steps.build.outputs.version }}"
|
|
|
|
|
|
|
|
permissions:
|
|
|
|
contents: read
|
2022-09-14 14:36:16 +00:00
|
|
|
pull-requests: write
|
2022-09-14 02:59:49 +00:00
|
|
|
id-token: write
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout aqua
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
repository: fluencelabs/aqua
|
|
|
|
|
|
|
|
- name: Download compiled aqua
|
|
|
|
uses: actions/download-artifact@v3
|
|
|
|
with:
|
|
|
|
name: aqua
|
|
|
|
|
|
|
|
- run: mv scala-*/cli-fastopt.js npm/aqua.js
|
|
|
|
|
|
|
|
- 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: "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
|
|
|
|
if: inputs.fluence-js-version != ''
|
|
|
|
working-directory: npm
|
2022-10-10 16:02:28 +00:00
|
|
|
run: npm i --save @fluencelabs/fluence@${{ inputs.fluence-js-version }}
|
2022-09-14 02:59:49 +00:00
|
|
|
|
|
|
|
- run: npm run build
|
|
|
|
working-directory: npm
|
|
|
|
|
|
|
|
- name: Generate package version
|
|
|
|
id: version
|
|
|
|
run: |
|
2022-09-14 14:36:16 +00:00
|
|
|
SHA=${{ github.event.pull_request.head.sha }}
|
|
|
|
echo "::set-output name=sha::${SHA::7}"
|
2022-09-14 02:59:49 +00:00
|
|
|
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: npm
|
|
|
|
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: npm
|
|
|
|
run: npm publish --tag snapshot --registry https://npm.fluence.dev
|
|
|
|
|
2022-09-14 14:36:16 +00:00
|
|
|
- name: Find comment in PR
|
2022-09-14 02:59:49 +00:00
|
|
|
uses: peter-evans/find-comment@v1
|
|
|
|
id: comment
|
|
|
|
with:
|
|
|
|
issue-number: "${{ github.event.pull_request.number }}"
|
|
|
|
comment-author: github-actions[bot]
|
|
|
|
body-includes: "## Aqua version is"
|
|
|
|
|
2022-09-14 14:36:16 +00:00
|
|
|
- name: Update comment in PR
|
2022-09-14 02:59:49 +00:00
|
|
|
uses: peter-evans/create-or-update-comment@v1
|
2022-09-14 14:36:16 +00:00
|
|
|
env:
|
|
|
|
AQUA_VERSION: ${{ steps.build.outputs.version }}
|
2022-09-14 02:59:49 +00:00
|
|
|
with:
|
|
|
|
comment-id: "${{ steps.comment.outputs.comment-id }}"
|
|
|
|
issue-number: "${{ github.event.pull_request.number }}"
|
|
|
|
edit-mode: replace
|
|
|
|
body: |
|
|
|
|
## Aqua version is [${{ env.AQUA_VERSION }}](https://npm.fluence.dev/-/web/detail/@fluencelabs/aqua/v/${{ env.AQUA_VERSION }})
|
|
|
|
To install it run:
|
|
|
|
```shell
|
|
|
|
npm login --registry https://npm.fluence.dev
|
2022-10-10 16:02:28 +00:00
|
|
|
npm i @fluencelabs/aqua@=${{ env.AQUA_VERSION }} --registry=https://npm.fluence.dev
|
2022-09-14 02:59:49 +00:00
|
|
|
```
|