Deploy #14
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@v3 | |
with: | |
node-version: 18 | |
- name: Update package version | |
run: | | |
version=${{ inputs.version_tag }} | |
sed -i "s/\"version\": \".*\"/\"version\": \"$version\"/" package.json | |
- 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 commit -m "Update package.json version to: ${{ inputs.version_tag }}" && \ | |
git push --force-with-lease origin main || \ | |
echo "Version tag unchanaged" | |
git tag "${{ inputs.version_tag }}" | |
git push --tags | |
- name: Publish Docs | |
run: | | |
rm -rf ./* ,/.* | |
mv ../docs_wip docs | |
git add . | |
git commit -m "Update Docs for version: ${{ inputs.version_tag }}" | |
git push --force origin HEAD:docs |