1010 - master
1111 - develop
1212
13+ permissions :
14+ contents : read
15+ id-token : write
16+ pull-requests : write
17+ packages : write
18+
19+
1320jobs :
1421 docker :
1522 name : Docker build
16- runs-on : ubuntu-8
17- services :
18- # local registery
19- registry :
20- image : registry:2
21- ports :
22- - 5000:5000
23-
23+ runs-on :
24+ group : Prod
2425 steps :
2526 - name : Checkout
2627 uses : actions/checkout@v4
2728 with :
2829 submodules : recursive
2930
31+ - name : Log in to the Container registry
32+ uses : docker/login-action@v3
33+ with :
34+ registry : ghcr.io
35+ username : ${{ github.actor }}
36+ password : ${{ github.token }}
37+
3038 - name : Set up Docker Buildx
3139 uses : docker/setup-buildx-action@v3
3240 with :
3341 driver-opts : network=host
3442
35- - name : Cache Docker layers
36- uses : actions/cache@v3
43+ - name : Extract metadata (tags, labels) for Docker
44+ id : meta
45+ uses : docker/metadata-action@v5
3746 with :
38- path : /tmp/.buildx-cache
39- key : ${{ runner.os }}-buildx-${{ hashFiles('Dockerfile') }}
40- restore-keys : ${{ runner.os }}-buildx-
47+ images : ghcr.io/${{ github.repository }}
48+ tags : |
49+ type=raw,value=latest,enable={{is_default_branch}}
50+ type=semver,pattern={{version}}
51+ type=semver,pattern={{major}}.{{minor}}
52+ type=semver,pattern={{major}}
53+ type=semver,pattern=v{{version}}
54+ type=semver,pattern=v{{major}}.{{minor}}
55+ type=semver,pattern=v{{major}}
56+ type=ref,event=branch
57+ type=ref,event=pr
58+ type=sha
59+ type=sha,format=long
60+ type=sha,prefix={{branch}}-,enable=${{ !startsWith(github.ref, 'refs/tags') }},event=branch
61+ type=sha,format=long,prefix={{branch}}-,enable=${{ !startsWith(github.ref, 'refs/tags') }},event=branch
4162
4263 - name : Build nitro-node docker
43- uses : docker/build-push-action@v5
64+ uses : docker/build-push-action@v6
4465 with :
4566 target : nitro-node
4667 push : true
4768 context : .
48- tags : localhost:5000/nitro-node:latest
49- cache-from : type=local,src=/tmp/.buildx-cache
50- cache-to : type=local,dest=/tmp/.buildx-cache-new,mode=max
51-
52- - name : Build nitro-node-dev docker
53- uses : docker/build-push-action@v5
54- with :
55- target : nitro-node-dev
56- push : true
57- context : .
58- tags : localhost:5000/nitro-node-dev:latest
59- cache-from : type=local,src=/tmp/.buildx-cache
60- cache-to : type=local,dest=/tmp/.buildx-cache-new,mode=max
61-
62- - name : Start background nitro-testnode
63- shell : bash
64- run : |
65- cd nitro-testnode
66- ./test-node.bash --init --dev &
67-
68- - name : Wait for rpc to come up
69- shell : bash
70- run : |
71- ${{ github.workspace }}/.github/workflows/waitForNitro.sh
72-
73- - name : Print WAVM module root
74- id : module-root
75- run : |
76- # Unfortunately, `docker cp` seems to always result in a "permission denied"
77- # We work around this by piping a tarball through stdout
78- docker run --rm --entrypoint tar localhost:5000/nitro-node-dev:latest -cf - target/machines/latest | tar xf -
79- module_root="$(cat "target/machines/latest/module-root.txt")"
80- echo "module-root=$module_root" >> "$GITHUB_OUTPUT"
81- echo -e "\x1b[1;34mWAVM module root:\x1b[0m $module_root"
82-
83- - name : Upload WAVM machine as artifact
84- uses : actions/upload-artifact@v3
85- with :
86- name : wavm-machine-${{ steps.module-root.outputs.module-root }}
87- path : target/machines/latest/*
88- if-no-files-found : error
89-
90- - name : Move cache
91- # Temp fix
92- # https://github.com/docker/build-push-action/issues/252
93- # https://github.com/moby/buildkit/issues/1896
94- run : |
95- rm -rf /tmp/.buildx-cache
96- mv /tmp/.buildx-cache-new /tmp/.buildx-cache
97-
98- - name : Clear cache on failure
99- if : failure()
100- run : |
101- keys=(${{ runner.os }}-buildx- ${{ runner.os }}-buildx-${{ hashFiles('Dockerfile') }})
102- for key in "${keys[@]}"; do
103- curl -X DELETE -H "Accept: application/vnd.github.v3+json" -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/repos/${{ github.repository }}/actions/caches/$key"
104- done
69+ tags : ${{ steps.meta.outputs.tags }}
70+ labels : ${{ steps.meta.outputs.labels }}
71+ cache-from : |
72+ type=registry,ref=ghcr.io/naturalselectionlabs/nitro:buildx-cache
73+ cache-to : |
74+ type=registry,ref=ghcr.io/naturalselectionlabs/nitro:buildx-cache,mode=max
0 commit comments