blog.trnck.dev

Publish using an actions workflow

+62
+62
.github/workflows/deploy.yaml
··· 1 + name: Publish to GitHub Pages 2 + 3 + # Run when new code is pushed to `main`. Also provide a button for manual deploys. 4 + on: 5 + push: 6 + branches: 7 + - master 8 + workflow_dispatch: 9 + 10 + concurrency: 11 + group: github_pages 12 + cancel-in-progress: true 13 + 14 + jobs: 15 + build: 16 + runs-on: ubuntu-latest 17 + permissions: 18 + contents: write 19 + steps: 20 + # Jekyll Picture Tag requires libvips libraries for resizing images, which must be installed 21 + - name: Install JPT's dependencies 22 + run: sudo apt-get install libvips-tools libpng-dev libwebp-dev libjpeg-dev libheif-dev 23 + 24 + # Put repository source onto the runner so we can build it 25 + - name: Checkout 26 + uses: actions/checkout@v4 27 + 28 + # Install the proper version of Ruby and run bundle install 29 + - name: 💎 Setup Ruby 30 + uses: ruby/setup-ruby@v1 31 + with: 32 + bundler-cache: true 33 + cache-version: 2 34 + ruby-version: "3.3" 35 + 36 + # Build the site 37 + - name: 🧪 Jekyll build 38 + run: bundle exec jekyll build 39 + env: 40 + JEKYLL_ENV: production 41 + - name: ⏫ Upload artifact to GitHub Pages 42 + id: artifact 43 + uses: actions/upload-pages-artifact@v1 44 + with: 45 + path: _site/ 46 + 47 + deploy: 48 + needs: build 49 + 50 + permissions: 51 + pages: write # to deploy to Pages 52 + id-token: write # to verify the deployment originates from an appropriate source 53 + 54 + environment: 55 + name: github-pages 56 + url: ${{ steps.deployment.outputs.page_url }} 57 + 58 + runs-on: ubuntu-latest 59 + steps: 60 + - name: Deploy to GitHub Pages 61 + id: deployment 62 + uses: actions/deploy-pages@v1