Added github pages workflow for compression, minimization build and d… #7
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 Optimized Plain HTML Site | |
| on: | |
| push: | |
| branches: ["main"] | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: false | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| # 1. Automatically compress images (JPG, PNG, SVG) | |
| - name: Compress Images | |
| uses: calibreapp/image-actions@main | |
| with: | |
| githubToken: ${{ secrets.GITHUB_TOKEN }} | |
| compressOnly: true | |
| # 2. Minify HTML, CSS, and JS to make the site load faster | |
| - name: Minify Source Code | |
| uses: functional-divergence/html-css-js-minifier@v2 | |
| with: | |
| directory: '.' | |
| # 3. Setup Pages metadata | |
| - name: Setup Pages | |
| uses: actions/configure-pages@v4 | |
| # 4. Upload the optimized files as an artifact | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: . | |
| 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 |