fluence-js/.github/workflows/publish_branch.yml

61 lines
1.6 KiB
YAML
Raw Normal View History

name: "publish-branch"
on:
workflow_dispatch:
jobs:
npm-publish:
name: "Publish"
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v3
- name: "Setup node with self-hosted npm registry"
uses: actions/setup-node@v2
with:
node-version: "16"
registry-url: "https://npm.fluence.dev"
- run: npm ci
- run: npm run 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: |
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"
env:
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 }}
- name: "Publish to self-hosted npm repo"
run: npm publish --tag snapshot --registry https://npm.fluence.dev