This repository was archived by the owner on Sep 30, 2025. It is now read-only.
Add discontinuation notice #2
This file contains hidden or 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 to GitHub Pages | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| # Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | |
| # However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: false | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version-file: '.node-version' | |
| cache: 'npm' | |
| - name: Setup Java | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '17' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Create .env file | |
| run: | | |
| echo "VERSION=$(git rev-parse HEAD)" >> .env | |
| echo "RELEASE_FOLDER=build" >> .env | |
| - name: Build project | |
| run: | | |
| # Make build script executable | |
| chmod +x scripts/build.sh | |
| # Create release folder | |
| mkdir -p build | |
| # Run the build commands directly to avoid sed -i "" issues on Linux | |
| source .env | |
| # Clean release folder | |
| rm -rf $RELEASE_FOLDER/* | |
| # Create directories | |
| mkdir -p $RELEASE_FOLDER/compiled/css | |
| mkdir -p $RELEASE_FOLDER/compiled/js | |
| mkdir -p $RELEASE_FOLDER/compiled/tailwind | |
| # Create symlinks | |
| ln -s ../resources/public/css/ $RELEASE_FOLDER/css | |
| ln -s ../resources/public/images/ $RELEASE_FOLDER/images | |
| ln -s ../resources/public/webfonts/ $RELEASE_FOLDER/webfonts | |
| # Build ClojureScript | |
| npm exec -- shadow-cljs release app \ | |
| --config-merge "{:output-dir \"$RELEASE_FOLDER/compiled/js/\"}" | |
| # Build Sass | |
| npm exec -- sass --source-map src/sass/app.sass $RELEASE_FOLDER/compiled/css/app.css | |
| # Build Tailwind CSS | |
| npm exec -- tailwindcss -i src/tailwind/styles.css -o $RELEASE_FOLDER/compiled/tailwind/styles.css -m | |
| # Rename and update files with version | |
| mv $RELEASE_FOLDER/compiled/tailwind/styles.css $RELEASE_FOLDER/compiled/tailwind/styles-$VERSION.css | |
| mv $RELEASE_FOLDER/compiled/css/app.css $RELEASE_FOLDER/compiled/css/app-$VERSION.css | |
| mv $RELEASE_FOLDER/compiled/css/app.css.map $RELEASE_FOLDER/compiled/css/app-$VERSION.css.map | |
| sed -i "s/sourceMappingURL=app\.css\.map/sourceMappingURL=app-$VERSION.css.map/" \ | |
| $RELEASE_FOLDER/compiled/css/app-$VERSION.css | |
| mv $RELEASE_FOLDER/compiled/js/app.js $RELEASE_FOLDER/compiled/js/app-$VERSION.js | |
| mv $RELEASE_FOLDER/compiled/js/app.js.map $RELEASE_FOLDER/compiled/js/app-$VERSION.js.map | |
| sed -i "s/sourceMappingURL=app\.js\.map/sourceMappingURL=app-$VERSION.js.map/" \ | |
| $RELEASE_FOLDER/compiled/js/app-$VERSION.js | |
| # Copy and update index.html | |
| cp resources/public/index.html $RELEASE_FOLDER/index.html | |
| sed -i \ | |
| -e "s/app\.css/app-$VERSION.css/" \ | |
| -e "s/styles\.css/styles-$VERSION.css/" \ | |
| -e "s/app\.js/app-$VERSION.js/" \ | |
| $RELEASE_FOLDER/index.html | |
| - name: Setup Pages | |
| uses: actions/configure-pages@v4 | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: './build' | |
| deploy: | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |