|
7 | 7 | branches: [master] |
8 | 8 |
|
9 | 9 | jobs: |
10 | | - build-image: |
| 10 | + build: |
11 | 11 | runs-on: ubuntu-latest |
12 | 12 | permissions: |
13 | 13 | contents: read |
14 | 14 | packages: write |
15 | | - outputs: |
16 | | - image: ${{ steps.image.outputs.image }} |
17 | 15 | steps: |
18 | 16 | - uses: actions/checkout@v4 |
19 | 17 |
|
20 | | - - name: Check if Dockerfile changed |
21 | | - id: filter |
22 | | - uses: dorny/paths-filter@v3 |
23 | | - with: |
24 | | - filters: | |
25 | | - dockerfile: |
26 | | - - 'xkcd-script/generator/Dockerfile' |
27 | | -
|
28 | 18 | - name: Log in to GitHub Container Registry |
29 | | - if: steps.filter.outputs.dockerfile == 'true' && github.event_name == 'push' |
| 19 | + if: github.event_name == 'push' |
30 | 20 | uses: docker/login-action@v3 |
31 | 21 | with: |
32 | 22 | registry: ghcr.io |
33 | 23 | username: ${{ github.actor }} |
34 | 24 | password: ${{ secrets.GITHUB_TOKEN }} |
35 | 25 |
|
36 | 26 | - name: Set up Docker Buildx |
37 | | - if: steps.filter.outputs.dockerfile == 'true' |
38 | 27 | uses: docker/setup-buildx-action@v3 |
39 | 28 |
|
40 | 29 | - name: Build (and push on master) Docker image |
41 | | - if: steps.filter.outputs.dockerfile == 'true' |
42 | 30 | uses: docker/build-push-action@v6 |
43 | 31 | with: |
44 | 32 | context: xkcd-script/generator |
| 33 | + load: true |
45 | 34 | push: ${{ github.event_name == 'push' }} |
46 | 35 | tags: ghcr.io/ipython/xkcd-font:fontbuilder |
47 | 36 | cache-from: type=gha |
48 | 37 | cache-to: type=gha,mode=max |
49 | 38 |
|
50 | | - - name: Set image name |
51 | | - id: image |
52 | | - run: echo "image=ghcr.io/ipython/xkcd-font:fontbuilder" >> "$GITHUB_OUTPUT" |
53 | | - |
54 | | - build-font: |
55 | | - runs-on: ubuntu-latest |
56 | | - needs: build-image |
57 | | - steps: |
58 | | - - uses: actions/checkout@v4 |
59 | | - |
60 | | - - name: Pull font builder image |
61 | | - run: docker pull ${{ needs.build-image.outputs.image }} |
62 | | - |
63 | 39 | - name: Generate font |
64 | | - run: FONTBUILDER_IMAGE=${{ needs.build-image.outputs.image }} xkcd-script/generator/run.sh |
| 40 | + run: FONTBUILDER_IMAGE=ghcr.io/ipython/xkcd-font:fontbuilder xkcd-script/generator/run.sh |
65 | 41 |
|
66 | 42 | - name: Generate samples |
67 | 43 | run: xkcd-script/samples/preview.sh |
|
81 | 57 |
|
82 | 58 | - name: Check generated files match committed files |
83 | 59 | run: | |
84 | | - git diff --exit-code xkcd-script/font/ xkcd-script/samples/ || { |
| 60 | + git diff --exit-code xkcd-script/font/xkcd-script.otf xkcd-script/font/xkcd-script.ttf xkcd-script/font/xkcd-script.woff xkcd-script/samples/ || { |
85 | 61 | echo "" |
86 | 62 | echo "Generated files differ from committed files." |
87 | 63 | echo "Download the 'xkcd-script-font' artifact from this run and commit the updated files." |
|
0 commit comments