Skip to content

Publish, prerelease:false, dry-run:false #161

Publish, prerelease:false, dry-run:false

Publish, prerelease:false, dry-run:false #161

Workflow file for this run

name: Publish
run-name: Publish, prerelease:${{ inputs.prerelease }}, dry-run:${{ inputs.dryrun }}
on:
workflow_dispatch:
inputs:
dryrun:
description: "Dry run"
required: false
default: false
type: boolean
prerelease:
description: "Prerelease"
required: false
default: false
type: boolean
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: write # create commits and releases
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # fetch tags
token: ${{ secrets.PAT }}
- name: Node
uses: ./.github/actions/node
- name: Setup git config
run: |
git config user.name "kiwicom-orbit-bot"
git config user.email "[email protected]"
- name: Build
run: |
# we need to build packages in the right order
# lerna won't run build due to --ignore-prepublish flag
yarn tokens build
yarn tailwind-preset build
yarn components build
- name: Dry run
if: ${{ github.event.inputs.dryrun == 'true' }}
run: |
if ${{ github.event.inputs.prerelease == 'true' }}; then
yarn lerna version --no-private --no-push --no-git-tag-version --conventional-prerelease --yes
else
yarn lerna version --no-private --no-push --no-git-tag-version --yes
fi
git diff
- name: Publish
if: ${{ github.event.inputs.dryrun == 'false' }}
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} # must be of type Automation to create releases
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SLACK_CHANGELOG_WEBHOOK_URL: ${{ secrets.SLACK_CHANGELOG_WEBHOOK_URL }}
run: |
echo "scope=@kiwicom" > ~/.npmrc
echo "access=public" >> ~/.npmrc
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
echo "//registry.npmjs.org/:always-auth=true" >> ~/.npmrc
if ${{ github.event.inputs.prerelease == 'true' }}; then
yarn lerna publish --no-private --conventional-commits --create-release github --ignore-prepublish --conventional-prerelease --yes
else
yarn lerna publish --no-private --conventional-commits --create-release github --ignore-prepublish --yes
fi
yarn docs changelog
git add docs/src/data/log.md && git commit -m "docs: update changelog" && git push
yarn zx scripts/post-changelog.mjs