@@ -75,10 +75,13 @@ jobs:
7575 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }} # To pull server without rate limit issues in CI
7676
7777 publish-docker :
78- name : Build & publish container to Docker Hub
78+ name : Build & publish container
7979 if : github.event_name == 'push' && !startsWith(github.ref, 'refs/heads/dependabot/')
8080 runs-on : ubuntu-latest
8181 needs : [build, test-windows-build]
82+ permissions :
83+ contents : read
84+ packages : write
8285 steps :
8386 - uses : actions/checkout@v4
8487
8790 name : dist
8891 path : dist
8992
93+ - name : Log in to GHCR
94+ uses : docker/login-action@v3
95+ with :
96+ registry : ghcr.io
97+ username : ${{ github.repository_owner }}
98+ password : ${{ secrets.GITHUB_TOKEN }}
99+
90100 - uses : docker/setup-buildx-action@v3
91101
92102 - name : Login to DockerHub
@@ -100,13 +110,15 @@ jobs:
100110 uses : docker/metadata-action@v5
101111 with :
102112 github-token : ${{ secrets.GITHUB_TOKEN }}
103- images : httptoolkit/ui
113+ images : |
114+ httptoolkit/ui
115+ ghcr.io/httptoolkit/ui
104116 tags : |
105117 type=raw,value=prod,enable={{is_default_branch}}
106118 type=raw,value=latest,enable={{is_default_branch}}
107119 type=sha
108120
109- - name : Build and publish to Docker Hub
121+ - name : Build and publish
110122 uses : docker/build-push-action@v5
111123 with :
112124 context : .
@@ -117,9 +129,33 @@ jobs:
117129 publish-scaleway :
118130 name : Deploy to Scaleway
119131 if : github.event_name == 'push' && github.ref == 'refs/heads/main'
132+ environment : production
120133 runs-on : ubuntu-latest
121134 needs : publish-docker
122135 steps :
136+ - uses : actions/checkout@v4
137+
138+ - name : Configure Kubectl
139+ run : |
140+ kubectl config set-cluster scw-cluster \
141+ --server="${{ vars.K8S_SERVER_ADDRESS }}" \
142+ --certificate-authority=<(echo "${{ vars.K8S_CA_CERT }}" | base64 -d) \
143+ --embed-certs=true
144+
145+ kubectl config set-credentials deployer --token="${{ secrets.K8S_DEPLOY_TOKEN }}"
146+
147+ kubectl config set-context default --cluster=scw-cluster --user=deployer
148+ kubectl config use-context default
149+
150+ - name : Deploy to Kubernetes
151+ run : |
152+ sed "s|/ui:latest|/ui:sha-${GITHUB_SHA::7}|g" deploy/deployment.yaml | \
153+ kubectl apply -f - \
154+ -f deploy/service.yaml \
155+ -f deploy/routes.yaml
156+
157+ kubectl rollout status deployment/httptoolkit-ui -n httptoolkit-ui
158+
123159 - name : Redeploy container
124160 uses : httptoolkit/scaleway-serverless-container-deploy-action@v1
125161 with :
0 commit comments