build #172
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: Node.js CI | |
on: | |
workflow_dispatch: | |
repository_dispatch: | |
types: ["build"] | |
push: | |
branches: ["main"] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: lts/* | |
cache: "npm" | |
- name: Node install | |
run: npm ci | |
- name: code gen | |
run: | | |
for script in src/scripts/* | |
do | |
npx -y tsx $script | |
done | |
npm run lint -- --diff HEAD --allow-empty | |
- name: Test | |
run: npm test | |
- name: set version | |
id: set-version | |
run: echo "version=$(curl https://raw.githubusercontent.com/poe-tool-dev/latest-patch-version/main/latest.txt)" >> "$GITHUB_OUTPUT" | |
- name: commit generated code | |
uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
commit_message: updated for ${{ steps.set-version.outputs.version }} | |
- name: show commit message | |
run: echo "VITE_GIT_COMMIT=$(git log --format=reference -n 1 HEAD)" >> $GITHUB_ENV | |
- name: Build | |
run: npm run build | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v1 | |
with: | |
path: dist | |
deploy: | |
needs: build | |
permissions: | |
pages: write | |
id-token: write | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v1 |