|
8 | 8 | strategy: |
9 | 9 | fail-fast: false |
10 | 10 | matrix: |
11 | | - ruby: [ '2.7', '3.0.1' ] |
| 11 | + ruby: [ '3.0.1' ] |
12 | 12 | name: Ruby ${{ matrix.ruby }} |
13 | 13 | steps: |
14 | 14 | - uses: actions/checkout@v3 |
|
21 | 21 | run: bundle install --jobs 4 --retry 3 |
22 | 22 | - name: build site |
23 | 23 | run: bundle exec jekyll build --limit-posts 10 |
| 24 | + docker-build: |
| 25 | + runs-on: ubuntu-22.04 |
| 26 | + name: Dockerised Jekyll Build |
| 27 | + steps: |
| 28 | + - uses: actions/checkout@v3 |
| 29 | + - name: Get changed files |
| 30 | + id: changes |
| 31 | + uses: dorny/paths-filter@v3 |
| 32 | + with: |
| 33 | + filters: | |
| 34 | + rebuild: |
| 35 | + - 'Dockerfile' |
| 36 | + - 'Gemfile' |
| 37 | + - 'Gemfile.lock' |
| 38 | + - '.github/workflows/ci.yml' |
| 39 | + diff_gemfile: |
| 40 | + - 'Gemfile.lock' |
| 41 | + - name: ghcr login |
| 42 | + uses: docker/login-action@v3 |
| 43 | + with: |
| 44 | + registry: ghcr.io |
| 45 | + username: ${{ github.actor }} |
| 46 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 47 | + - name: monero-site ruby build env (pull or build) |
| 48 | + run: | |
| 49 | + tag_name="ghcr.io/${GITHUB_REPOSITORY_OWNER}/monero-site-ruby:latest" |
| 50 | + case "${{ steps.changes.outputs.rebuild }}" in |
| 51 | + true) |
| 52 | + docker build -t "$tag_name" . |
| 53 | + ;; |
| 54 | + *) |
| 55 | + docker pull "$tag_name" || docker build -t "$tag_name" . |
| 56 | + ;; |
| 57 | + esac |
| 58 | + - name: Build Jekyll site with Docker |
| 59 | + run: docker run -v $(pwd):/srv/jekyll ghcr.io/${GITHUB_REPOSITORY_OWNER}/monero-site-ruby bundle exec jekyll build --limit-posts 10 |
| 60 | + - name: Push new image to ghcr |
| 61 | + if: github.event_name == 'push' && github.ref == 'refs/heads/master' |
| 62 | + run: docker push -a ghcr.io/${GITHUB_REPOSITORY_OWNER}/monero-site-ruby |
| 63 | + - name: Confirm Gemfile update |
| 64 | + if: steps.changes.outputs.diff_gemfile |
| 65 | + run: | |
| 66 | + cp Gemfile.lock Gemfile.lock.update |
| 67 | + docker run -v $(pwd):/srv/jekyll ghcr.io/${GITHUB_REPOSITORY_OWNER}/monero-site-ruby bundle update |
| 68 | + if ! diff Gemfile.lock Gemfile.lock.update; then |
| 69 | + echo "Gemfile.lock updates do not match" |
| 70 | + exit 1 |
| 71 | + fi |
0 commit comments