Skip to content

Continuous Delivery #103

Continuous Delivery

Continuous Delivery #103

name: Continuous Delivery
on:
workflow_dispatch:
inputs:
version:
description: 'what version to release'
required: true
type: string
dry:
description: 'Dry run'
required: false
type: boolean
jobs:
publish:
name: Publish to NPM
runs-on: ubuntu-latest
steps:
- name: Checkout Project
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
with:
fetch-depth: 0
ref: ${{ 'main' }}
token: ${{secrets.GH_TOKEN}}
- name: Use Node.js v18
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4
with:
node-version: 18
registry-url: https://registry.npmjs.org/
- name: Locate Yarn Cache
id: yarn-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
- name: Yarn Cache
uses: actions/cache@v4
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install Dependencies
run: yarn --immutable
- name: Build
run: yarn build
- name: Bump Version & Publish
if: ${{ inputs.dry }}
run: |
git config --global user.name 'DanCodes'
git config --global user.email '[email protected]'
yarn release-it --ci -i ${{ inputs.version }} -d
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
- name: Bump Version & Publish
if: ${{ !inputs.dry }}
run: |
git config --global user.name 'DanCodes'
git config --global user.email '[email protected]'
yarn docs &&
git add . &&
git commit -m "docs(${{ inputs.version }}): generate documentation [no ci]" &&
git push &&
yarn release-it --ci -i ${{ inputs.version }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}