Add update and display of version number #13
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: Build and Deploy | |
on: | |
push: | |
branches: | |
- main | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '22' | |
cache: 'npm' | |
- name: Version | |
run: | | |
BASE_VERSION=$(npm run get-version --silent) | |
# Remove last digit and dot, then append run number | |
VERSION=$(echo $BASE_VERSION | sed 's/\.[0-9]*$/.'${{ github.run_number }}/) | |
echo "VERSION=$VERSION" >> $GITHUB_ENV | |
shell: bash | |
- name: Update package.json version | |
run: npm version $VERSION --no-git-tag-version | |
shell: bash | |
- name: Install dependencies | |
run: npm ci | |
- name: Build | |
run: npm run build | |
- name: Copy index.html to 404.html | |
run: cp dist/angor-hub/browser/index.html dist/angor-hub/browser/404.html | |
- name: Setup Pages | |
uses: actions/configure-pages@v3 | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v2 | |
with: | |
path: './dist/angor-hub/browser' | |
- name: Deploy to GitHub Pages | |
uses: actions/deploy-pages@v2 |