2022-09-06 14:51:43 +00:00
|
|
|
name: Publish snapshot
|
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_call:
|
2022-09-13 16:24:20 +00:00
|
|
|
inputs:
|
|
|
|
avm-version:
|
|
|
|
description: "@fluencelabs/avm version"
|
|
|
|
type: string
|
2022-09-06 14:51:43 +00:00
|
|
|
outputs:
|
|
|
|
fluence-js-version:
|
2022-09-13 16:24:20 +00:00
|
|
|
description: "@fluencelabs/fluence version"
|
2022-09-06 14:51:43 +00:00
|
|
|
value: ${{ jobs.publish-snapshot.outputs.fluence-js-version }}
|
|
|
|
|
|
|
|
env:
|
|
|
|
FORCE_COLOR: true
|
|
|
|
CI: true
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
publish-snapshot:
|
|
|
|
name: "Publish snapshot"
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
outputs:
|
|
|
|
fluence-js-version: "${{ steps.build.outputs.version }}"
|
|
|
|
|
|
|
|
permissions:
|
|
|
|
contents: read
|
2022-09-14 14:43:17 +00:00
|
|
|
pull-requests: write
|
2022-09-06 14:51:43 +00:00
|
|
|
id-token: write
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout fluence-js
|
|
|
|
uses: actions/checkout@v3
|
2022-09-13 16:24:20 +00:00
|
|
|
with:
|
|
|
|
repository: fluencelabs/fluence-js
|
2022-09-06 14:51:43 +00:00
|
|
|
|
|
|
|
- uses: pnpm/action-setup@v2.2.2
|
|
|
|
with:
|
|
|
|
version: 7
|
|
|
|
|
|
|
|
- name: Setup node with self-hosted npm registry
|
2022-09-13 16:24:20 +00:00
|
|
|
uses: actions/setup-node@v3
|
2022-09-06 14:51:43 +00:00
|
|
|
with:
|
|
|
|
node-version: "16"
|
|
|
|
registry-url: "https://npm.fluence.dev"
|
2022-09-13 16:24:20 +00:00
|
|
|
cache: "pnpm"
|
|
|
|
|
2022-09-14 14:43:17 +00:00
|
|
|
- run: pnpm i
|
|
|
|
|
2022-09-13 16:24:20 +00:00
|
|
|
- name: Set avm version from branch
|
|
|
|
if: inputs.avm-version != ''
|
|
|
|
working-directory: packages/fluence-js
|
2022-10-10 18:03:03 +00:00
|
|
|
run: pnpm add --save -E @fluencelabs/avm@${{ inputs.avm-version }}
|
2022-09-06 14:51:43 +00:00
|
|
|
|
|
|
|
- run: pnpm -r build
|
|
|
|
|
|
|
|
- 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: Generate package version
|
|
|
|
id: version
|
|
|
|
run: |
|
2022-09-14 14:43:17 +00:00
|
|
|
SHA=${{ github.event.pull_request.head.sha }}
|
2022-10-31 15:10:22 +00:00
|
|
|
echo "sha=${SHA::7}" >> $GITHUB_OUTPUT
|
|
|
|
echo "branch=${GITHUB_HEAD_REF//[^a-zA-Z0-9-]/-}" >> $GITHUB_OUTPUT
|
2022-09-06 14:51:43 +00:00
|
|
|
|
|
|
|
- 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 }}
|
|
|
|
run: |
|
|
|
|
node ci.js bump-version ${{ env.BRANCH }}-${{ env.SHA }}-${{ env.RUN }}-${{ env.ATTEMPT }}
|
2022-10-31 15:10:22 +00:00
|
|
|
echo "version=$(node ci.js get-version)" >> $GITHUB_OUTPUT
|
2022-09-06 14:51:43 +00:00
|
|
|
|
|
|
|
- name: Publish to self-hosted npm repo
|
|
|
|
run: pnpm --no-git-checks --registry https://npm.fluence.dev -r publish --tag e2e -filter '@fluencelabs/*'
|
|
|
|
|
2022-10-31 15:10:22 +00:00
|
|
|
- name: Print versions to check summary
|
2022-09-14 14:43:17 +00:00
|
|
|
env:
|
2022-10-31 15:10:22 +00:00
|
|
|
VERSION: ${{ steps.build.outputs.version }}
|
|
|
|
run: |
|
|
|
|
cat <<'SNAPSHOT' >> $GITHUB_STEP_SUMMARY
|
|
|
|
## FluenceJS version is [${{ env.VERSION }}](https://npm.fluence.dev/-/web/detail/@fluencelabs/fluence/v/${{ env.VERSION }})
|
|
|
|
To use it run:
|
|
|
|
```shell
|
|
|
|
npm i -E @fluencelabs/fluence@${{ env.VERSION }} --registry=https://npm.fluence.dev
|
|
|
|
```
|
|
|
|
SNAPSHOT
|