@@ -92,10 +92,13 @@ jobs:
9292 fi
9393
9494 publish-docker :
95- name : Build & publish container to Docker Hub
95+ name : Build & publish container
9696 if : github.ref == 'refs/heads/main' || (github.event_name == 'push' && !startsWith(github.ref, 'refs/heads/dependabot/'))
9797 runs-on : ubuntu-latest
9898 needs : build
99+ permissions :
100+ contents : read
101+ packages : write
99102 steps :
100103 - uses : actions/checkout@v4
101104
@@ -104,6 +107,13 @@ jobs:
104107 name : out
105108 path : out
106109
110+ - name : Log in to GHCR
111+ uses : docker/login-action@v3
112+ with :
113+ registry : ghcr.io
114+ username : ${{ github.repository_owner }}
115+ password : ${{ secrets.GITHUB_TOKEN }}
116+
107117 - uses : docker/setup-buildx-action@v3
108118 - name : Login to DockerHub
109119 uses : docker/login-action@v3
@@ -116,14 +126,16 @@ jobs:
116126 uses : docker/metadata-action@v5
117127 with :
118128 github-token : ${{ secrets.GITHUB_TOKEN }}
119- images : httptoolkit/website
129+ images : |
130+ httptoolkit/website
131+ ghcr.io/httptoolkit/website
120132 tags : |
121133 type=raw,value=prod,enable=${{ github.ref == 'refs/heads/main' }}
122134 type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
123135 type=raw,value=staging,enable=${{ github.ref == 'refs/heads/next' }}
124136 type=sha
125137
126- - name : Publish to Docker Hub
138+ - name : Publish container
127139 uses : docker/build-push-action@v5
128140 with :
129141 context : .
@@ -137,6 +149,27 @@ jobs:
137149 runs-on : ubuntu-latest
138150 needs : publish-docker
139151 steps :
152+ - uses : actions/checkout@v4
153+
154+ - name : Configure Kubectl
155+ run : |
156+ kubectl config set-cluster scw-cluster \
157+ --server="${{ vars.K8S_SERVER_ADDRESS }}" \
158+ --certificate-authority=<(echo "${{ vars.K8S_CA_CERT }}" | base64 -d) \
159+ --embed-certs=true
160+
161+ kubectl config set-credentials deployer --token="${{ secrets.K8S_DEPLOY_TOKEN }}"
162+
163+ kubectl config set-context default --cluster=scw-cluster --user=deployer
164+ kubectl config use-context default
165+
166+ - name : Deploy to Kubernetes
167+ run : |
168+ sed "s|/website:latest|/website:${{ vars.DOCKER_IMAGE_TAG }}|g" deploy/deployment.yaml | \
169+ kubectl apply -f - \
170+ -f deploy/service.yaml \
171+ -f deploy/routes.yaml
172+
140173 - name : Redeploy container
141174 uses : httptoolkit/deploy-scaleway-serverless-container-action@v1
142175 with :
0 commit comments