From 35b52fade8e51269beecaa439a7d76c23b9a186e Mon Sep 17 00:00:00 2001 From: amalshaji Date: Tue, 5 Mar 2024 22:33:06 +0530 Subject: [PATCH] add release workflow --- .github/workflows/release.yml | 75 +++++++++++++++++++++++++++++++++++ .goreleaser.yaml | 62 +++++++++++++++++++++++++++++ 2 files changed, 137 insertions(+) create mode 100644 .github/workflows/release.yml create mode 100644 .goreleaser.yaml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..1460d5a5 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,75 @@ +name: Publish packages + +on: + push: + # run only against tags + tags: + - "*" + +permissions: + contents: write + # packages: write + # issues: write + +jobs: + goreleaser: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - run: git fetch --force --tags + + - name: Setup go + uses: actions/setup-go@v3 + with: + go-version: ">=1.22" + cache: true + + - name: Publish packages + uses: goreleaser/goreleaser-action@v4 + with: + distribution: goreleaser + version: latest + args: release --clean + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + HOMEBREW_TAP_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }} +# docker: +# runs-on: ubuntu-latest +# steps: +# - uses: actions/checkout@v3 +# with: +# fetch-depth: 0 + +# - name: Set up QEMU +# uses: docker/setup-qemu-action@v2 + +# - name: Set up Docker Buildx +# uses: docker/setup-buildx-action@v2 + +# - name: Docker meta +# id: meta +# uses: docker/metadata-action@v4 +# with: +# images: | +# amalshaji/beaver +# tags: | +# type=semver,pattern={{version}} + +# - name: Login to Docker Hub +# uses: docker/login-action@v2 +# with: +# username: amalshaji +# password: ${{ secrets.DOCKERHUB_TOKEN }} + +# - name: Build and push +# uses: docker/build-push-action@v4 +# with: +# context: . +# push: true +# tags: ${{ steps.meta.outputs.tags }} +# platforms: | +# linux/amd64 +# linux/arm64 +# file: deployments/Dockerfile diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 00000000..e2050a53 --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,62 @@ +builds: + - id: "portr" + main: ./cmd/portr + binary: "portr" + dir: tunnel + env: + - CGO_ENABLED=0 + goos: + - linux + - windows + - darwin + goarch: + - amd64 + - arm64 + ldflags: + - -s -w -X main.build={{.Version}} + +archives: + - format: zip + name_template: >- + {{ .Binary }}_ + {{- .Version }}_ + {{- title .Os }}_ + {{- if eq .Arch "amd64" }}x86_64 + {{- else if eq .Arch "386" }}i386 + {{- else }}{{ .Arch }}{{ end }} + {{- if .Arm }}v{{ .Arm }}{{ end }} + id: portr + +checksum: + name_template: "checksums.txt" + +snapshot: + name_template: "{{ incpatch .Version }}-next" + +changelog: + sort: asc + filters: + exclude: + - "^docs:" + - "^test:" + +release: + name_template: "v{{ .Version }}" + draft: true + footer: | + ## Server docker images + + https://hub.docker.com/r/amalshaji/portr/tags + +brews: + - name: portr + ids: + - portr + homepage: https://github.com/amalshaji/portr + repository: + owner: amalshaji + name: homebrew-taps + token: "{{ .Env.HOMEBREW_TAP_TOKEN }}" + commit_author: + name: Amal Shaji + email: amalshajid@gmail.com