Skip to content

Commit 7028399

Browse files
authored
Merge pull request #14 from kc3hack/ci-next-build
GitHub Container Registry へ push するようにしてみる
2 parents b4e893f + 2d0ee3f commit 7028399

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

Diff for: .github/workflows/akane-next-test.yaml

+52
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,55 @@ jobs:
3838
run: npm run lint -w packages/akane-next
3939
- name: Test
4040
run: npm run test -w packages/akane-next
41+
- name: Build
42+
run: npm run build -w packages/akane-next
43+
44+
build-and-push:
45+
runs-on: ubuntu-latest
46+
timeout-minutes: 10
47+
permissions:
48+
contents: read
49+
pull-requests: read
50+
id-token: write
51+
actions: write
52+
packages: write
53+
steps:
54+
- name: Checkout
55+
uses: actions/checkout@v4
56+
- name: Login to GitHub Container Registry
57+
uses: docker/login-action@v3
58+
with:
59+
registry: ghcr.io
60+
username: ${{ github.repository_owner }}
61+
password: ${{ secrets.GITHUB_TOKEN }}
62+
- uses: docker/metadata-action@v4
63+
id: meta
64+
with:
65+
images: ghcr.io/${{ github.repository }}/akane-next
66+
# デフォルトブランチの時だけ latest タグをつけてそれ以外は日時とコミットハッシュをつける
67+
# ref: https://github.com/docker/metadata-action?tab=readme-ov-file#customizing
68+
tags: |
69+
type=raw,value=latest,enable={{is_default_branch}}
70+
type=raw,value={{date 'YYYYMMDD-HHmmss' tz='Asia/Tokyo'}}-{{sha}}
71+
# Open Container Initiative (OCI) の Image Spec に基づくラベル
72+
# ref:
73+
# - https://github.com/opencontainers/image-spec/blob/fbb4662eb53b80bd38f7597406cf1211317768f0/annotations.md?plain=1#L18-L26
74+
labels: |
75+
org.opencontainers.image.authors="rokuosan, taiseiue, nenrinyear, Retasusan, ikotome"
76+
org.opencontainers.image.url="https://github.com/kc3hack/2025_9"
77+
org.opencontainers.image.documentation="https://github.com/kc3hack/2025_9"
78+
org.opencontainers.image.source="https://github.com/kc3hack/2025_9"
79+
- name: Build and push
80+
uses: docker/build-push-action@v6
81+
with:
82+
context: ./packages/akane-next
83+
file: ./docker/akane-next/Dockerfile
84+
platforms: linux/amd64
85+
tags: ${{ steps.meta.outputs.tags }}
86+
labels: ${{ steps.meta.outputs.labels }}
87+
push: true
88+
provenance: false
89+
env:
90+
NODE_ENV: production
91+
- name: Image digest
92+
run: echo ${{ steps.docker_build.outputs.digest }}

0 commit comments

Comments
 (0)