fluence-js/.github/workflows/publish_branch.yml
2022-08-24 18:03:06 +03:00

70 lines
1.9 KiB
YAML

name: "Publish development branch packages"
on:
push:
jobs:
publish-branch:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2.2.2
with:
version: 7
- name: "Setup node with self-hosted npm registry"
uses: actions/setup-node@v2
with:
node-version: "16"
registry-url: "https://npm.fluence.dev"
- name: "Build packages"
run: |
pnpm i
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: |
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: |
for package in packages/*; do
cd $package
pnpm version prepatch --no-git-tag-version \
--preid ${{ env.BRANCH }}-${{ env.SHA }}-${{ env.RUN }}-${{ env.ATTEMPT }}
cd -
done
- name: "Publish to self-hosted npm repo"
run: pnpm --no-git-checks --registry https://npm.fluence.dev -r publish --tag snapshot -filter '@fluencelabs/*'