|
| 1 | +name: Deploy Jekyll site to Pages |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: ["master", "transfering_old_docs_site"] # run it from this branch, for faster iteration |
| 6 | + |
| 7 | + # Allows you to run this workflow manually from the Actions tab |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +permissions: |
| 11 | + contents: read |
| 12 | + pages: write |
| 13 | + id-token: write |
| 14 | + |
| 15 | +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. |
| 16 | +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. |
| 17 | +concurrency: |
| 18 | + group: "pages" |
| 19 | + cancel-in-progress: false |
| 20 | + |
| 21 | +jobs: |
| 22 | + # Build job |
| 23 | + build: |
| 24 | + runs-on: ubuntu-latest |
| 25 | + steps: |
| 26 | + - name: Checkout |
| 27 | + uses: actions/checkout@v4 |
| 28 | + - name: Setup Ruby # uses version from .ruby-version |
| 29 | + uses: ruby/setup-ruby@354a1ad156761f5ee2b7b13fa8e09943a5e8d252 # v1.179.0 |
| 30 | + with: |
| 31 | + bundler-cache: true # runs 'bundle install' and caches installed gems automatically |
| 32 | + cache-version: 0 # Increment this number if you need to re-download cached gems |
| 33 | + - name: Setup Pages |
| 34 | + id: pages |
| 35 | + uses: actions/configure-pages@v5 |
| 36 | + - name: Build with Jekyll |
| 37 | + # Outputs to the './_site' directory by default |
| 38 | + run: bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}" |
| 39 | + env: |
| 40 | + JEKYLL_ENV: production |
| 41 | + - name: Setup Node.js |
| 42 | + uses: actions/setup-node@v4 |
| 43 | + with: |
| 44 | + node-version: '18' |
| 45 | + - name: Install Minifiers |
| 46 | + run: npm install -g uglify-js csso-cli |
| 47 | + - name: Minify JavaScript |
| 48 | + run: | |
| 49 | + find _site -name "*.js" -exec uglifyjs --compress --mangle -o {} -- {} \; |
| 50 | + - name: Minify CSS |
| 51 | + run: | |
| 52 | + find _site -name "*.css" -exec csso --input {} --output {} \; |
| 53 | + - name: Upload artifact |
| 54 | + # Automatically uploads an artifact from the './_site' directory by default |
| 55 | + uses: actions/upload-pages-artifact@v3 |
| 56 | + |
| 57 | + # Deployment job |
| 58 | + deploy: |
| 59 | + environment: |
| 60 | + name: github-pages |
| 61 | + url: ${{ steps.deployment.outputs.page_url }} |
| 62 | + runs-on: ubuntu-latest |
| 63 | + needs: build |
| 64 | + steps: |
| 65 | + - name: Deploy to GitHub Pages |
| 66 | + id: deployment |
| 67 | + uses: actions/deploy-pages@v4 |
| 68 | + |
0 commit comments