Deploy #22
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: Deploy | |
on: | |
workflow_dispatch: | |
inputs: | |
version_tag: | |
description: "Version tag for the package" | |
required: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
- name: Update package version | |
run: | | |
version=${{ inputs.version_tag }} | |
npm version $version --no-git-tag-version | |
- name: Install packages | |
run: | | |
npm ci | |
- name: Build | |
run: | | |
npm run build | |
- name: Generate Docs | |
run: | | |
npm run build-docs | |
mv docs ../docs_wip | |
- name: Remove Non-distributables | |
run: | | |
rm .gitignore | |
rm tsconfig.json | |
rm wisp.ts | |
rm -rf wisp_api wisp_socket .github | |
- name: Publish | |
uses: JS-DevTools/npm-publish@v3 | |
with: | |
token: ${{ secrets.NPM_PUBLISH_TOKEN }} | |
- name: Configure Git User | |
run: | | |
git config user.name github-actions | |
git config user.email [email protected] | |
- name: Push package version change | |
run: | | |
git add package.json | |
git add package-lock.json | |
git commit -m "Update package.json version to: ${{ inputs.version_tag }}" && \ | |
git push --force-with-lease origin main || \ | |
echo "Version tag unchanaged" | |
- name: Push new tag | |
run: | | |
git tag "${{ inputs.version_tag }}" | |
git push --tags | |
- name: Publish Docs | |
run: | | |
# Delete everything except .git | |
find . -mindepth 1 -maxdepth 1 ! -name '.git' -exec rm -rf {} + | |
# Move the docs back and commit only them | |
mv ../docs_wip docs | |
git add . | |
git commit -m "Update Docs for version: ${{ inputs.version_tag }}" | |
git push --force origin HEAD:docs |