@@ -25,41 +25,39 @@ jobs:
2525 - name : Checkout repository
2626 uses : actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
2727
28- - name : Set up Docker Buildx
29- uses : docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3
28+ - name : Install nerdctl and containerd
29+ run : |
30+ # Install containerd
31+ sudo apt-get update
32+ sudo apt-get install -y containerd
33+ sudo systemctl start containerd
34+
35+ # Install nerdctl
36+ NERDCTL_VERSION=2.0.2
37+ curl -sSL "https://github.com/containerd/nerdctl/releases/download/v${NERDCTL_VERSION}/nerdctl-${NERDCTL_VERSION}-linux-amd64.tar.gz" | sudo tar -xz -C /usr/local/bin
38+
39+ # Install CNI plugins
40+ CNI_VERSION=1.6.1
41+ sudo mkdir -p /opt/cni/bin
42+ curl -sSL "https://github.com/containernetworking/plugins/releases/download/v${CNI_VERSION}/cni-plugins-linux-amd64-v${CNI_VERSION}.tgz" | sudo tar -xz -C /opt/cni/bin
3043
3144 - name : Log in to GHCR
32- uses : docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3
33- with :
34- registry : ${{ env.REGISTRY }}
35- username : ${{ github.actor }}
36- password : ${{ secrets.GITHUB_TOKEN }}
37-
38- - name : Extract metadata
39- id : meta
40- uses : docker/metadata-action@369eb591f429131d6889c46b94e711f089e6ca96 # v5
41- with :
42- images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
43- tags : |
44- type=semver,pattern={{version}}
45- type=semver,pattern={{major}}.{{minor}}
46- type=ref,event=branch
47- type=sha
48-
49- - name : Build and push
50- id : push
51- uses : docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75 # v6
52- with :
53- context : .
54- push : true
55- tags : ${{ steps.meta.outputs.tags }}
56- labels : ${{ steps.meta.outputs.labels }}
57- cache-from : type=gha
58- cache-to : type=gha,mode=max
59-
60- - name : Generate artifact attestation
61- uses : actions/attest-build-provenance@ef244123eb79f2f7a7e75d99086184180e6d0018 # v2
62- with :
63- subject-name : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
64- subject-digest : ${{ steps.push.outputs.digest }}
65- push-to-registry : true
45+ run : |
46+ echo "${{ secrets.GITHUB_TOKEN }}" | sudo nerdctl login ghcr.io -u ${{ github.actor }} --password-stdin
47+
48+ - name : Build image
49+ run : |
50+ sudo nerdctl build -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }} .
51+ sudo nerdctl tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }} ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
52+
53+ - name : Push image
54+ run : |
55+ sudo nerdctl push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}
56+ sudo nerdctl push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
57+
58+ - name : Tag release version
59+ if : github.event_name == 'release'
60+ run : |
61+ VERSION=${{ github.event.release.tag_name }}
62+ sudo nerdctl tag ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }} ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${VERSION}
63+ sudo nerdctl push ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${VERSION}
0 commit comments