Minor spelling mistakes #19
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 Offline Browsable Version | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
permissions: | |
contents: write | |
id-token: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "21" | |
- name: Set environment variable for hash router | |
run: echo "USE_HASH_ROUTER=true" >> $GITHUB_ENV | |
- name: Install dependencies | |
run: npm ci | |
- name: Build the offline site | |
run: npm run build | |
continue-on-error: true # sometimes it gives errors, but the page is still browsable. Will remove this when the experimental_router is stable | |
- name: Create a release directory | |
run: mkdir -p release && cp -r build/* release | |
- name: Get version from package.json | |
id: get_version | |
run: echo "PACKAGE_VERSION=$(jq -r '.version' package.json)" >> $GITHUB_ENV | |
- name: Create a versioned zip file of the offline site | |
run: cd release && zip -r ../docugrammar-offline-v${{ env.PACKAGE_VERSION }}.zip . | |
- name: Upload Release Asset | |
uses: actions/upload-artifact@v4 | |
with: | |
name: docugrammar-offline | |
path: docugrammar-offline-v${{ env.PACKAGE_VERSION }}.zip | |
- name: Get latest tag | |
id: get_tag | |
run: | | |
latest_tag=$(git tag | sort -V | tail -n 1) | |
if [ -z "$latest_tag" ]; then | |
new_tag="v${{ env.PACKAGE_VERSION }}" | |
else | |
new_tag="v$(( ${latest_tag#v} + 1 ))" | |
fi | |
echo "latest_tag=$new_tag" >> $GITHUB_ENV | |
- name: Create tag | |
run: | | |
git config user.name "github-actions" | |
git config user.email "[email protected]" | |
git tag ${{ env.latest_tag }} | |
git push origin ${{ env.latest_tag }} | |
- name: Create GitHub release | |
id: create_release | |
uses: softprops/action-gh-release@v2 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ env.latest_tag }} | |
name: v${{ env.PACKAGE_VERSION }} | |
body: | | |
Release version ${{ env.PACKAGE_VERSION }} of the project. | |
files: docugrammar-offline-v${{ env.PACKAGE_VERSION }}.zip |