Manual-Version-Release #18
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
# Manual workflow to release new package version | |
name: Manual-Version-Release | |
on: | |
workflow_dispatch: | |
inputs: | |
changeLog: | |
description: "Change Log" | |
required: true | |
default: "" | |
releaseType: | |
type: choice | |
description: Select patch/minor/major | |
options: | |
- patch | |
- minor | |
- major | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
steps: | |
- run: echo 'Starting the workflow' | |
- uses: oprypin/find-latest-tag@v1 | |
id: get-latest-tag | |
with: | |
repository: unstoppabledomains/resolution # current repositiry | |
releases-only: false | |
- name: "Get next versions" | |
id: semvers | |
uses: "WyriHaximus/github-action-next-semvers@v1" | |
with: | |
version: ${{ steps.get-latest-tag.outputs.tag }} | |
- name: Set new tag | |
id: set-new-tag | |
run: | | |
if [[ ${{ github.event.inputs.releaseType }} == major ]]; then | |
echo "tag=${{ steps.semvers.outputs.v_major }}" >> $GITHUB_OUTPUT | |
elif [[ ${{ github.event.inputs.releaseType }} == minor ]]; then | |
echo "tag=${{ steps.semvers.outputs.v_minor }}" >> $GITHUB_OUTPUT | |
else | |
echo "tag=${{ steps.semvers.outputs.v_patch }}" >> $GITHUB_OUTPUT | |
fi | |
- name: "Log inputs" | |
run: | | |
echo Release Version: ${{ steps.set-new-tag.outputs.tag }} | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
ref: master | |
token: ${{ secrets.RELEASE_SECRET }} | |
- name: New package.json version | |
run: yarn version --new-version ${{ steps.set-new-tag.outputs.tag }} --no-git-tag-version | |
- name: "Create tag" | |
run: | | |
git tag ${{ steps.set-new-tag.outputs.tag }} | |
git push origin --tags | |
- name: Setup node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
always-auth: true | |
registry-url: "https://registry.npmjs.org" | |
- run: | |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_AUTH_TOKEN }}" | |
> ~/.npmrc | |
- name: Install Dependencies | |
run: yarn install | |
- name: Build | |
run: yarn build | |
- name: Publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} | |
run: yarn publish | |
- name: Commit new version | |
uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
branch: ${{ github.event.release.target_commitish }} | |
commit_message: Release new version ${{ steps.set-new-tag.outputs.tag }} | |
- name: Deploy docs | |
run: yarn docs:deploy |