From 96c6ebb8b621026de1b311096bc212edd1d3618a Mon Sep 17 00:00:00 2001 From: buty4649 Date: Fri, 10 Apr 2026 17:43:41 +0900 Subject: [PATCH 1/3] =?UTF-8?q?feat:=20Dockerfile=E3=81=A8GHCR=E3=81=B8?= =?UTF-8?q?=E3=81=AE=E3=82=A4=E3=83=A1=E3=83=BC=E3=82=B8=E3=83=93=E3=83=AB?= =?UTF-8?q?=E3=83=89=E3=83=AF=E3=83=BC=E3=82=AF=E3=83=95=E3=83=AD=E3=83=BC?= =?UTF-8?q?=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.6 (1M context) --- .github/workflows/docker.yml | 37 ++++++++++++++++++++++++++++++++++++ Dockerfile | 19 ++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 .github/workflows/docker.yml create mode 100644 Dockerfile diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..6706731 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,37 @@ +name: Build image + +on: + pull_request: + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + build-and-push: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - uses: actions/checkout@v4 + + - uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - uses: docker/metadata-action@v5 + id: meta + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=sha,prefix= + + - uses: docker/build-push-action@v6 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..f76bfbc --- /dev/null +++ b/Dockerfile @@ -0,0 +1,19 @@ +FROM golang:1.26 AS builder + +WORKDIR /app + +COPY go.mod go.sum ./ +RUN go mod download + +COPY . . +RUN CGO_ENABLED=0 go build -ldflags="-s -w" -trimpath -o plusplusbot . + +FROM gcr.io/distroless/static-debian12 + +LABEL org.opencontainers.image.source=https://github.com/pepabo/plusplusbot + +WORKDIR /app + +COPY --from=builder /app/plusplusbot . + +CMD ["./plusplusbot"] From 638db1be9b6229f41ea6b489c313090cb2332cb2 Mon Sep 17 00:00:00 2001 From: buty4649 Date: Fri, 10 Apr 2026 17:50:46 +0900 Subject: [PATCH 2/3] =?UTF-8?q?feat:=20=E3=82=A4=E3=83=A1=E3=83=BC?= =?UTF-8?q?=E3=82=B8=E3=83=93=E3=83=AB=E3=83=89=E3=82=92release=E3=83=AF?= =?UTF-8?q?=E3=83=BC=E3=82=AF=E3=83=95=E3=83=AD=E3=83=BC=E3=81=AB=E7=B5=B1?= =?UTF-8?q?=E5=90=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 独立していたdocker.ymlを削除し、release.ymlにbuild-imageジョブとして統合。 リリース時にlatestタグとバージョンタグ付きでGHCRにpushされるようにした。 Co-Authored-By: Claude Opus 4.6 (1M context) --- .github/workflows/docker.yml | 37 ----------------------------------- .github/workflows/release.yml | 33 +++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 37 deletions(-) delete mode 100644 .github/workflows/docker.yml diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml deleted file mode 100644 index 6706731..0000000 --- a/.github/workflows/docker.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: Build image - -on: - pull_request: - -env: - REGISTRY: ghcr.io - IMAGE_NAME: ${{ github.repository }} - -jobs: - build-and-push: - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - steps: - - uses: actions/checkout@v4 - - - uses: docker/login-action@v3 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - uses: docker/metadata-action@v5 - id: meta - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - tags: | - type=sha,prefix= - - - uses: docker/build-push-action@v6 - with: - context: . - push: true - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d5dff99..c8ee643 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,6 +5,10 @@ on: tags: - 'v[0-9]*.[0-9]*.[0-9]*' +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + jobs: goreleaser: runs-on: ubuntu-latest @@ -16,3 +20,32 @@ jobs: - uses: ./.github/actions/release with: github_token: ${{ secrets.GITHUB_TOKEN }} + + build-image: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - uses: actions/checkout@v4 + + - uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - uses: docker/metadata-action@v5 + id: meta + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=semver,pattern={{version}} + type=raw,value=latest + + - uses: docker/build-push-action@v6 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} From d8e415148d028a220d77a4ee63f3d4232b085929 Mon Sep 17 00:00:00 2001 From: buty4649 Date: Fri, 10 Apr 2026 17:51:19 +0900 Subject: [PATCH 3/3] =?UTF-8?q?chore:=20pinact=E3=81=A7GitHub=20Actions?= =?UTF-8?q?=E3=81=AE=E3=83=90=E3=83=BC=E3=82=B8=E3=83=A7=E3=83=B3=E3=82=92?= =?UTF-8?q?SHA=E3=83=94=E3=83=B3=E7=95=99=E3=82=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.6 (1M context) --- .github/actions/release/action.yml | 4 ++-- .github/workflows/ci.yml | 6 +++--- .github/workflows/release.yml | 10 +++++----- .github/workflows/tagpr.yml | 6 +++--- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/actions/release/action.yml b/.github/actions/release/action.yml index b240ad3..08dfff0 100644 --- a/.github/actions/release/action.yml +++ b/.github/actions/release/action.yml @@ -10,13 +10,13 @@ runs: using: "composite" steps: - name: Set up Go - uses: actions/setup-go@v5 + uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 with: go-version-file: 'go.mod' cache: true - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v6 + uses: goreleaser/goreleaser-action@ec59f474b9834571250b370d4735c50f8e2d1e29 # v7.0.0 with: distribution: goreleaser version: latest diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ec6168d..7ae0eaa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,16 +8,16 @@ jobs: name: Test runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - name: Set up Go - uses: actions/setup-go@v5 + uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 with: go-version-file: 'go.mod' cache: true - name: Run golangci-lint - uses: golangci/golangci-lint-action@v8 + uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v9.2.0 with: version: latest diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c8ee643..1ee3bf4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,7 +13,7 @@ jobs: goreleaser: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: fetch-depth: 0 @@ -27,15 +27,15 @@ jobs: contents: read packages: write steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - - uses: docker/login-action@v3 + - uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0 with: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - uses: docker/metadata-action@v5 + - uses: docker/metadata-action@030e881283bb7a6894de51c315a6bfe6a94e05cf # v6.0.0 id: meta with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} @@ -43,7 +43,7 @@ jobs: type=semver,pattern={{version}} type=raw,value=latest - - uses: docker/build-push-action@v6 + - uses: docker/build-push-action@d08e5c354a6adb9ed34480a06d141179aa583294 # v7.0.0 with: context: . push: true diff --git a/.github/workflows/tagpr.yml b/.github/workflows/tagpr.yml index 6c89b1a..3623596 100644 --- a/.github/workflows/tagpr.yml +++ b/.github/workflows/tagpr.yml @@ -16,14 +16,14 @@ jobs: steps: - name: Generate token id: generate_token - uses: actions/create-github-app-token@v1 + uses: actions/create-github-app-token@f8d387b68d61c58ab83c6c016672934102569859 # v3.0.0 with: app-id: ${{ secrets.PR_MAKER_APP_ID }} private-key: ${{ secrets.PR_MAKER_APP_PRIVATE_KEY }} - - uses: actions/checkout@v4 + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: token: ${{ steps.generate_token.outputs.token }} - - uses: Songmu/tagpr@v1 + - uses: Songmu/tagpr@9d0f650553240dab1fa907eca27e3fd5b586e538 # v1.18.1 env: GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}