1111
1212
1313jobs :
14- build :
15- name : Build
14+ static-checks :
15+ name : Static Checks
16+ runs-on : ubuntu-latest
17+ steps :
18+ - name : Checkout whatwg/html-build
19+ uses : actions/checkout@v3
20+ - name : Install Rust toolchain
21+ uses : actions-rs/toolchain@v1
22+ with :
23+ toolchain : stable
24+ components : rustfmt, clippy
25+ - name : Cache Cargo dependencies
26+ uses : actions/cache@v3
27+ with :
28+ path : |
29+ ~/.cargo/bin/
30+ ~/.cargo/registry/index/
31+ ~/.cargo/registry/cache/
32+ ~/.cargo/git/db/
33+ target/
34+ key : ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
35+ - name : Check formatting
36+ run : cargo fmt --check
37+ - name : Run clippy
38+ run : cargo clippy -- -D warnings
39+ - name : Run tests
40+ run : cargo test
41+ - name : Shellcheck
42+ run : |
43+ shellcheck *.sh
44+ shellcheck ci-build/*.sh
45+
46+ build-and-test-image :
47+ name : Build and Test Image
1648 runs-on : ubuntu-latest
17- permissions :
18- contents : read
19- packages : write
2049 steps :
2150 - name : Checkout whatwg/html-build
2251 uses : actions/checkout@v3
2352 with :
2453 fetch-depth : 0
25- - name : Shellcheck
26- run : |
27- shellcheck *.sh
28- shellcheck ci-build/*.sh
2954 - name : Docker build
3055 run : ci-build/docker-build.sh
3156 - name : Checkout whatwg/html
@@ -38,15 +63,23 @@ jobs:
3863 run : |
3964 mkdir output
4065 bash ci-build/docker-run.sh "$GITHUB_WORKSPACE/html" output
66+
67+ publish :
68+ name : Publish
69+ runs-on : ubuntu-latest
70+ needs : [static-checks, build-and-test-image]
71+ if : ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
72+ permissions :
73+ contents : read
74+ packages : write
75+ steps :
4176 - name : Docker login
42- if : ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
4377 uses : docker/login-action@v2
4478 with :
4579 registry : ${{ env.REGISTRY }}
4680 username : ${{ github.actor }}
4781 password : ${{ secrets.GITHUB_TOKEN }}
4882 - name : Docker push
49- if : ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
5083 run : |
5184 docker tag "$REGISTRY/$IMAGE_NAME" "$REGISTRY/$IMAGE_NAME:$GITHUB_SHA"
5285 docker tag "$REGISTRY/$IMAGE_NAME" "$REGISTRY/$IMAGE_NAME:latest"
0 commit comments