Skip to content

Commit a4f1cdf

Browse files
cmyuiclaude
andcommitted
Migrate CI/CD from Docker Hub to GitHub Container Registry
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 3aa6439 commit a4f1cdf

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

.github/workflows/production-deploy.yml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,26 @@ concurrency:
1212
jobs:
1313
production-deploy:
1414
runs-on: ubuntu-latest
15+
permissions:
16+
contents: read
17+
packages: write
1518

1619
steps:
1720
- name: Check out latest commit
1821
uses: actions/checkout@v4
1922

20-
- name: Log in to Docker Hub
23+
- name: Log in to GitHub Container Registry
2124
uses: docker/login-action@v3
2225
with:
23-
username: ${{ secrets.DOCKERHUB_USERNAME }}
24-
password: ${{ secrets.DOCKERHUB_TOKEN }}
26+
registry: ghcr.io
27+
username: ${{ github.actor }}
28+
password: ${{ secrets.GITHUB_TOKEN }}
2529

2630
- name: Extract metadata (tags, labels) for Docker
2731
id: meta
2832
uses: docker/metadata-action@v5
2933
with:
30-
images: osuakatsuki/beatmaps-service
34+
images: ghcr.io/osuakatsuki/beatmaps-service
3135

3236
- name: Build and push Docker image
3337
uses: docker/build-push-action@v5
@@ -36,8 +40,8 @@ jobs:
3640
file: ./Dockerfile
3741
push: true
3842
tags: |
39-
${{ secrets.DOCKERHUB_USERNAME }}/beatmaps-service:latest
40-
${{ secrets.DOCKERHUB_USERNAME }}/beatmaps-service:${{ github.sha }}
43+
ghcr.io/osuakatsuki/beatmaps-service:latest
44+
ghcr.io/osuakatsuki/beatmaps-service:${{ github.sha }}
4145
labels: ${{ steps.meta.outputs.labels }}
4246

4347
- name: Deploy to production
@@ -46,7 +50,11 @@ jobs:
4650
host: ${{ secrets.SERVER_HOST }}
4751
username: root
4852
key: ${{ secrets.SERVER_SSH_KEY }}
53+
envs: GHCR_TOKEN
4954
script: |
55+
echo "$GHCR_TOKEN" | docker login ghcr.io -u github-actions --password-stdin
5056
cd /opt/akatsuki
5157
docker compose pull beatmaps-service
5258
docker compose up -d beatmaps-service
59+
env:
60+
GHCR_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)