2020-12-29 12:38:20 +00:00
|
|
|
name: "publish-branch"
|
|
|
|
|
|
|
|
on:
|
2022-08-18 12:12:25 +00:00
|
|
|
workflow_dispatch:
|
2020-12-29 12:38:20 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
npm-publish:
|
|
|
|
name: "Publish"
|
|
|
|
runs-on: ubuntu-latest
|
2022-08-18 12:12:25 +00:00
|
|
|
|
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
id-token: write
|
2020-12-29 12:38:20 +00:00
|
|
|
|
|
|
|
steps:
|
2022-08-18 12:12:25 +00:00
|
|
|
- uses: actions/checkout@v3
|
2020-12-29 12:38:20 +00:00
|
|
|
|
2022-08-18 12:12:25 +00:00
|
|
|
- name: "Setup node with self-hosted npm registry"
|
|
|
|
uses: actions/setup-node@v2
|
2020-12-29 12:38:20 +00:00
|
|
|
with:
|
2022-08-18 12:12:25 +00:00
|
|
|
node-version: "16"
|
|
|
|
registry-url: "https://npm.fluence.dev"
|
2020-12-29 12:38:20 +00:00
|
|
|
|
2022-08-18 12:12:25 +00:00
|
|
|
- run: npm ci
|
2020-12-29 12:38:20 +00:00
|
|
|
- run: npm run build
|
|
|
|
|
2022-08-18 12:12:25 +00:00
|
|
|
- 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: |
|
|
|
|
BRANCH=${GITHUB_REF#refs/heads/}
|
|
|
|
SHA=$(git rev-parse --short HEAD)
|
|
|
|
|
|
|
|
echo "::set-output name=sha::$SHA"
|
|
|
|
echo "::set-output name=branch::${BRANCH//[^a-zA-Z0-9-]/-}"
|
|
|
|
|
|
|
|
- name: "Set package version"
|
2020-12-29 12:38:20 +00:00
|
|
|
env:
|
2022-08-18 12:12:25 +00:00
|
|
|
BRANCH: ${{ steps.version.outputs.branch }}
|
|
|
|
SHA: ${{ steps.version.outputs.sha }}
|
|
|
|
RUN: ${{ github.run_number }}
|
|
|
|
ATTEMPT: ${{ github.run_attempt }}
|
|
|
|
run: |
|
|
|
|
npm version prerelease --no-git-tag-version \
|
|
|
|
--preid ${{ env.BRANCH }}-${{ env.SHA }}-${{ env.RUN }}-${{ env.ATTEMPT }}
|
2021-09-08 08:28:22 +00:00
|
|
|
|
2022-08-18 12:12:25 +00:00
|
|
|
- name: "Publish to self-hosted npm repo"
|
|
|
|
run: npm publish --tag snapshot --registry https://npm.fluence.dev
|