From 23e800b38f577e4a16ebffbf26fba5b836a076a2 Mon Sep 17 00:00:00 2001 From: Sung-Kyu Yoo Date: Mon, 20 Apr 2026 08:15:05 +0900 Subject: [PATCH 1/3] feat: add GoReleaser + Changie release pipeline Replicate the release process from acor project: - GoReleaser config for multi-platform binary builds and Docker images - Changie for structured changelog management - Tag-triggered GitHub Actions release workflow - Dockerfile.goreleaser for Alpine-based container builds - Makefile changelog target for batch + merge --- .changie.yaml | 23 ++++++++++++ .github/workflows/release.yml | 52 ++++++++++++++++++++++++++ .goreleaser.yaml | 70 +++++++++++++++++++++++++++++++++++ Dockerfile.goreleaser | 11 ++++++ Makefile | 5 ++- changes/header.tpl.md | 0 6 files changed, 160 insertions(+), 1 deletion(-) create mode 100644 .changie.yaml create mode 100644 .github/workflows/release.yml create mode 100644 .goreleaser.yaml create mode 100644 Dockerfile.goreleaser create mode 100644 changes/header.tpl.md diff --git a/.changie.yaml b/.changie.yaml new file mode 100644 index 0000000..a4dc700 --- /dev/null +++ b/.changie.yaml @@ -0,0 +1,23 @@ +changesDir: changes +unreleasedDir: unreleased +headerPath: header.tpl.md +changelogPath: CHANGELOG.md +versionExt: md +versionFormat: '## [{{ .Version }}](https://github.com/skyoo2003/devcloud/releases/tag/{{ .Version }}) - {{ .Time.Format "2006-01-02" }}' + + +kindFormat: "### {{ .Kind }}" +changeFormat: "* {{ .Body }} ([#{{ .Custom.Issue }}](https://github.com/skyoo2003/devcloud/issues/{{ .Custom.Issue }}))" +kinds: + - label: Added + - label: Changed + - label: Deprecated + - label: Removed + - label: Fixed + - label: Security + - label: Documentation +custom: + - key: Issue + label: Issue Number + type: int + minInt: 1 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..4f61c1a --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,52 @@ +name: Release + +on: + push: + tags: + - 'v*' + +jobs: + release: + runs-on: ubuntu-latest + permissions: + contents: write + packages: write + attestations: write + steps: + - name: Checkout the code + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 + with: + fetch-depth: 0 + - name: Set up Go + uses: actions/setup-go@v6 + with: + go-version-file: go.mod + cache-dependency-path: go.sum + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4 + - name: Login to GitHub Container Registry + uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Verify changie release notes exist + run: | + if [ ! -f "changes/${{ github.ref_name }}.md" ]; then + echo "::error::Changie fragment changes/${{ github.ref_name }}.md not found." + echo "::error::Run 'changie batch ${{ github.ref_name }}' and 'changie merge' before pushing the tag." + exit 1 + fi + - name: Execute GoReleaser + uses: goreleaser/goreleaser-action@ec59f474b9834571250b370d4735c50f8e2d1e29 # goreleaser-action v7 + with: + distribution: goreleaser + version: "~> v2" + args: release --clean --release-notes changes/${{ github.ref_name }}.md + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Upload assets + uses: actions/upload-artifact@v7 + with: + name: devcloud + path: dist/* diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000..2e69eb0 --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,70 @@ +version: 2 + +project_name: devcloud + +env: +- GO111MODULE=on +- CGO_ENABLED=0 + +before: + hooks: + - go mod download + +builds: +- id: devcloud + binary: devcloud + main: cmd/devcloud/main.go + goos: + - darwin + - linux + - windows + goarch: + - amd64 + - arm64 + +archives: +- id: devcloud + format: tar.gz + format_overrides: + - goos: windows + format: zip + files: + - LICENSE + - README.md + - CHANGELOG.md + +changelog: + disable: false + +checksum: + algorithm: sha256 + name_template: 'CHECKSUMS' + +dockers_v2: +- images: + - ghcr.io/skyoo2003/devcloud + dockerfile: Dockerfile.goreleaser + ids: + - devcloud + sbom: false + flags: + - "--provenance=false" + tags: + - "{{ .Tag }}-alpine" + - "v{{ .Major }}.{{ .Minor }}-alpine" + - "v{{ .Major }}-alpine" + - "latest-alpine" + labels: + org.opencontainers.image.created: "{{ .Date }}" + org.opencontainers.image.source: "https://github.com/skyoo2003/devcloud" + org.opencontainers.image.title: "{{ .ProjectName }}" + org.opencontainers.image.revision: "{{ .FullCommit }}" + org.opencontainers.image.version: "{{ .Version }}" + +release: + github: + owner: skyoo2003 + name: devcloud + name_template: "v{{ .Version }}" + disable: false + mode: replace diff --git a/Dockerfile.goreleaser b/Dockerfile.goreleaser new file mode 100644 index 0000000..675689c --- /dev/null +++ b/Dockerfile.goreleaser @@ -0,0 +1,11 @@ +FROM --platform=$BUILDPLATFORM alpine:3.21 + +RUN adduser --system --home /devcloud appuser +VOLUME /devcloud +WORKDIR /devcloud +ARG TARGETOS +ARG TARGETARCH +COPY ${TARGETOS}/${TARGETARCH}/devcloud /usr/bin/devcloud + +USER appuser +ENTRYPOINT ["devcloud"] diff --git a/Makefile b/Makefile index 15a4669..2716e60 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: build test codegen run clean test-compat build-web build-all docker-build docker-run +.PHONY: build test codegen run clean test-compat build-web build-all docker-build docker-run changelog build: go build -o dist/devcloud ./cmd/devcloud @@ -32,3 +32,6 @@ docker-run: clean: rm -rf dist/ data/ + +changelog: + @changie batch $(VERSION) && changie merge diff --git a/changes/header.tpl.md b/changes/header.tpl.md new file mode 100644 index 0000000..e69de29 From ffec4f6c507b31f61ec5fb5e5626afb82c7b350a Mon Sep 17 00:00:00 2001 From: Sung-Kyu Yoo Date: Mon, 20 Apr 2026 08:17:24 +0900 Subject: [PATCH 2/3] fix: address code review feedback - Pin actions/setup-go and actions/upload-artifact to commit SHAs - Fix release name_template to avoid double "v" prefix (vv1.2.3) - Add VERSION guard to Makefile changelog target --- .github/workflows/release.yml | 4 ++-- .goreleaser.yaml | 2 +- Makefile | 3 +++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4f61c1a..acd8e4f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,7 +18,7 @@ jobs: with: fetch-depth: 0 - name: Set up Go - uses: actions/setup-go@v6 + uses: actions/setup-go@41dfa10bef8ca8f7c4c7cec63b269ccb8a9156b9 # v6 with: go-version-file: go.mod cache-dependency-path: go.sum @@ -46,7 +46,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Upload assets - uses: actions/upload-artifact@v7 + uses: actions/upload-artifact@5d5df5e032fcb57d3c9d9901e9b8f8b2b7d8051a # v7 with: name: devcloud path: dist/* diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 2e69eb0..31a9b78 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -65,6 +65,6 @@ release: github: owner: skyoo2003 name: devcloud - name_template: "v{{ .Version }}" + name_template: "{{ .Version }}" disable: false mode: replace diff --git a/Makefile b/Makefile index 2716e60..8c76022 100644 --- a/Makefile +++ b/Makefile @@ -34,4 +34,7 @@ clean: rm -rf dist/ data/ changelog: +ifndef VERSION + $(error VERSION is required. Usage: make changelog VERSION=v0.2.0) +endif @changie batch $(VERSION) && changie merge From abc75fa6c0705dfc04c95b23c64c15ac6e0fd208 Mon Sep 17 00:00:00 2001 From: Sung-Kyu Yoo Date: Mon, 20 Apr 2026 08:24:44 +0900 Subject: [PATCH 3/3] fix: address second round of code review feedback - Move VERSION guard into recipe to avoid global parse-time error - Centralize owner/repo via GoReleaser template variables (.Env.GITHUB_REPOSITORY_OWNER, .ProjectName) to avoid hardcoding - Remove hardcoded release.github.owner (GoReleaser auto-detects) --- .goreleaser.yaml | 7 ++----- Makefile | 7 ++++--- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 31a9b78..7ea5be1 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -42,7 +42,7 @@ checksum: dockers_v2: - images: - - ghcr.io/skyoo2003/devcloud + - ghcr.io/{{ .Env.GITHUB_REPOSITORY_OWNER }}/{{ .ProjectName }} dockerfile: Dockerfile.goreleaser ids: - devcloud @@ -56,15 +56,12 @@ dockers_v2: - "latest-alpine" labels: org.opencontainers.image.created: "{{ .Date }}" - org.opencontainers.image.source: "https://github.com/skyoo2003/devcloud" + org.opencontainers.image.source: "https://github.com/{{ .Env.GITHUB_REPOSITORY_OWNER }}/{{ .ProjectName }}" org.opencontainers.image.title: "{{ .ProjectName }}" org.opencontainers.image.revision: "{{ .FullCommit }}" org.opencontainers.image.version: "{{ .Version }}" release: - github: - owner: skyoo2003 - name: devcloud name_template: "{{ .Version }}" disable: false mode: replace diff --git a/Makefile b/Makefile index 8c76022..72adeec 100644 --- a/Makefile +++ b/Makefile @@ -34,7 +34,8 @@ clean: rm -rf dist/ data/ changelog: -ifndef VERSION - $(error VERSION is required. Usage: make changelog VERSION=v0.2.0) -endif + @if [ -z "$(VERSION)" ]; then \ + echo "VERSION is required. Usage: make changelog VERSION=v0.2.0"; \ + exit 1; \ + fi @changie batch $(VERSION) && changie merge