feat: test deploy #1
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# from node-osc package | ||
# This is a basic workflow that is manually triggered | ||
name: Bump version | ||
# Controls when the action will run. Workflow runs when manually triggered using the UI | ||
# or API. | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
release_version: | ||
type: choice | ||
description: 'The version to release will default to patch if not provided' | ||
required: true | ||
default: patch | ||
options: | ||
- patch | ||
- minor | ||
- major | ||
- beta | ||
- alpha | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | ||
jobs: | ||
setup-node: | ||
uses: ./.github/workflows/ci.yml | ||
runs-on: ubuntu-latest | ||
secrets: inherit | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Check out source | ||
uses: actions/checkout@v3 | ||
with: | ||
ssh-key: ${{ secrets.DEPLOY_KEY }} | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '16' | ||
bump-version: | ||
needs: release-sdk | ||
steps: | ||
- name: Mark Git directory as Safe | ||
run: | | ||
git config --global --add safe.directory "$GITHUB_WORKSPACE" | ||
- name: Bump version | ||
id: bump_version | ||
outputs: | ||
version: ${{ steps.bump_version.outputs.version }} | ||
run: | | ||
if [[ "${{ github.event.inputs.version_override }}" == beta || "${{ github.event.inputs.version_override }}" == alpha ]]; then | ||
npm version prerelease --preid="${{ github.event.inputs.version_override }}" | ||
else | ||
npm version "${{ github.event.inputs.version_override }}" | ||
fi | ||
version=$(cat package.json \ | ||
| grep version \ | ||
| head -1 \ | ||
| awk -F: '{ print $2 }' \ | ||
| sed 's/[",]//g') | ||
echo "version=$version" >> $GITHUB_OUTPUT | ||
publish: | ||
name: Publish to npm | ||
runs-on: ubuntu-latest | ||
needs: bump-version | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v2 | ||
with: | ||
node-version: '16' | ||
- name: Publish | ||
run: | | ||
npm config set //registry.npmjs.org/:_authToken ${PUBLISH_TOKEN} | ||
npm ci | ||
npm run build | ||
npm publish | ||
env: | ||
NPM_TOKEN: ${{ secrets.PUBLISH_TOKEN }} | ||
create-github-release: | ||
name: Create GitHub Release | ||
runs-on: ubuntu-latest | ||
needs: publish | ||
steps: | ||
- name: Push Tag | ||
run: | | ||
git config user.name "${GITHUB_ACTOR}" | ||
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" | ||
git tag -a "${tag}" -m "${message}" | ||
git push origin "${tag}" | ||
env: | ||
tag: v${{needs.bump-version.outputs.version}} | ||
message: Release v${{needs.bump-version.outputs.version}} |