Automatically deploy new tag onto github pages #29
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
name: Create new release and deploy onto github pages | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: 'Version' | |
required: true | |
type: string | |
jobs: | |
deploy: | |
name: Deploy new version | |
runs-on: ubuntu-latest | |
env: | |
CI: '' | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GITHUB_REPOSITORY: ${{ github.repository }} | |
steps: | |
- name: checkout | |
uses: actions/checkout@v3 | |
- name: setup node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 'latest' | |
cache: 'npm' | |
- name: install dependencies | |
run: npm ci | |
- name: git config | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "github-actions-bot" | |
git remote set-url origin https://git:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git | |
- name: create version | |
run: | | |
git fetch --all | |
git checkout --track origin/master | |
git checkout -b release-${{ inputs.version }} | |
npm version ${{ inputs.version }} | |
- name: create PR and GH release | |
run: | | |
gh pr create --title "Release ${{ inputs.version }}" -B master -H release-${{ inputs.version }} | |
gh pr merge release-${{ inputs.version }} --delete-branch | |
gh release create ${{ inputs.version }} --generate-notes | |
- name: deploy with gh-pages | |
run: npm run deploy |