fluence-js/.github/workflows/snapshot.yml
2022-10-31 18:10:22 +03:00

102 lines
2.9 KiB
YAML

name: Publish snapshot
on:
workflow_call:
inputs:
avm-version:
description: "@fluencelabs/avm version"
type: string
outputs:
fluence-js-version:
description: "@fluencelabs/fluence version"
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
pull-requests: write
id-token: write
steps:
- name: Checkout fluence-js
uses: actions/checkout@v3
with:
repository: fluencelabs/fluence-js
- uses: pnpm/action-setup@v2.2.2
with:
version: 7
- name: Setup node with self-hosted npm registry
uses: actions/setup-node@v3
with:
node-version: "16"
registry-url: "https://npm.fluence.dev"
cache: "pnpm"
- run: pnpm i
- name: Set avm version from branch
if: inputs.avm-version != ''
working-directory: packages/fluence-js
run: pnpm add --save -E @fluencelabs/avm@${{ inputs.avm-version }}
- 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: |
SHA=${{ github.event.pull_request.head.sha }}
echo "sha=${SHA::7}" >> $GITHUB_OUTPUT
echo "branch=${GITHUB_HEAD_REF//[^a-zA-Z0-9-]/-}" >> $GITHUB_OUTPUT
- 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 }}
echo "version=$(node ci.js get-version)" >> $GITHUB_OUTPUT
- name: Publish to self-hosted npm repo
run: pnpm --no-git-checks --registry https://npm.fluence.dev -r publish --tag e2e -filter '@fluencelabs/*'
- name: Print versions to check summary
env:
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