Skip to content
This repository has been archived by the owner on Mar 28, 2022. It is now read-only.

Commit

Permalink
update goreleaser
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergey Vilgelm committed Apr 21, 2021
1 parent 9c5ba48 commit 86ff0f4
Show file tree
Hide file tree
Showing 3 changed files with 138 additions and 47 deletions.
5 changes: 3 additions & 2 deletions .github/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
FROM alpine:latest
FROM alpine

RUN apk add --no-cache git
RUN apk update && apk upgrade && \
apk add --no-cache git
COPY bumptag /usr/bin/bumptag

ENTRYPOINT [ "bumptag" ]
Expand Down
49 changes: 33 additions & 16 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
milestone:
types: [closed]
env:
GO: 1.14.x
GO: 1.16

jobs:
bump-version:
Expand All @@ -32,42 +32,59 @@ jobs:
docker run --rm -v $PWD:/mount -w /mount svtools/bumptag:latest ${{ github.event.milestone.title }}
- name: Push Tag
run: git push origin --tags
build:

release:
if: github.event_name == 'push'
runs-on: ubuntu-latest
env:
DOCKER_CLI_EXPERIMENTAL: "enabled"
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Install Go
uses: actions/setup-go@v2
with:
go-version: ${{ env.GO }}
- name: Checkout code
uses: actions/checkout@v2

- name: Prepare gpg
run: |
gpgconf --kill gpg-agent
gpg --quiet --batch --yes --decrypt --passphrase="${{ secrets.GPG_PASSPHRASE }}" --output .github/sv-tools-bot.asc .github/sv-tools-bot.asc.gpg
gpg --batch --yes --import .github/sv-tools-bot.asc
rm .github/sv-tools-bot.asc
- name: Docker Login Github
run: >-
echo "${{ secrets.BOT_TOKEN }}"
| docker login -u sv-tools-bot --password-stdin docker.pkg.github.com
- name: Docker Login Hub
run: >-
echo "${{ secrets.DOCKER_HUB_TOKEN }}"
| docker login -u svtools --password-stdin
- name: Install Snapcraft
run: |
sudo apt-get -yq --no-install-suggests --no-install-recommends install snapcraft
- name: Allow arm Docker builds # https://github.com/linuxkit/linuxkit/tree/master/pkg/binfmt
run: sudo docker run --privileged linuxkit/binfmt:v0.8

- name: Docker Login
uses: docker/login-action@v1
with:
registry: ghcr.io
username: sv-tools-bot
password: ${{ secrets.BOT_TOKEN }}

- name: Docker Login
uses: docker/login-action@v1
with:
username: svtools
password: ${{ secrets.DOCKER_HUB_TOKEN }}

- name: Snapcraft Login
env:
SNAPCRAFT_LOGIN: ${{ secrets.SNAPCRAFT_LOGIN }}
run: |
sudo apt-get -yq --no-install-suggests --no-install-recommends install snapcraft
snapcraft login --with <(echo "$SNAPCRAFT_LOGIN")
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
version: latest
args: release --rm-dist
args: release --rm-dist --debug
env:
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }}

- name: Clear
if: always()
run: rm -f ${HOME}/.docker/config.json
131 changes: 102 additions & 29 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,13 @@ release:
name: bumptag

builds:
- binary: bumptag
- binary: "{{ .ProjectName }}"
goos:
- darwin
- linux
goarch:
- amd64
- arm
- arm64
goarm:
- 6
- 7
env:
- CGO_ENABLED=0
main: ./
Expand All @@ -25,7 +21,7 @@ builds:
archives:
- format: tar.gz
wrap_in_directory: true
name_template: "{{ .Binary }}-{{ .Tag }}-{{ .Os }}-{{ .Arch }}{{if .Arm}}v{{.Arm}}{{end}}"
name_template: "{{ .Binary }}-{{ .Tag }}-{{ .Os }}-{{ .Arch }}"

checksum:
name_template: "{{ .ProjectName }}-{{ .Tag }}-checksums.txt"
Expand All @@ -34,38 +30,115 @@ signs:
- artifacts: checksum

dockers:
- dockerfile: .github/Dockerfile
binaries:
- bumptag
image_templates:
- "docker.pkg.github.com/sv-tools/{{ .ProjectName }}/{{ .ProjectName }}:{{ .Tag }}"
- "docker.pkg.github.com/sv-tools/{{ .ProjectName }}/{{ .ProjectName }}:v{{ .Major }}"
- "docker.pkg.github.com/sv-tools/{{ .ProjectName }}/{{ .ProjectName }}:latest"
- "svtools/{{ .ProjectName }}:{{ .Tag }}"
- "svtools/{{ .ProjectName }}:v{{ .Major }}"
- "svtools/{{ .ProjectName }}:latest"
- image_templates: ["ghcr.io/sv-tools/{{ .ProjectName }}:{{ .Tag }}-amd64"]
dockerfile: .github/Dockerfile
use_buildx: true
goarch: amd64
build_flag_templates:
- "--platform=linux/amd64"
- "--label=org.opencontainers.image.title={{ .ProjectName }}"
- "--label=org.opencontainers.image.description=bumptag is a tool to increment a version and to create a git tag with an annotation"
- "--label=org.opencontainers.image.url={{ .GitURL }}"
- "--label=org.opencontainers.image.source={{ .GitURL }}"
- "--label=org.opencontainers.image.version={{ .Tag }}"
- '--label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }}'
- "--label=org.opencontainers.image.revision={{ .FullCommit }}"
- "--label=org.opencontainers.image.licenses=MIT"
- image_templates: ["ghcr.io/sv-tools/{{ .ProjectName }}:{{ .Tag }}-arm64v8"]
dockerfile: .github/Dockerfile
use_buildx: true
goarch: arm64
build_flag_templates:
- "--platform=linux/arm64/v8"
- "--label=org.opencontainers.image.title={{ .ProjectName }}"
- "--label=org.opencontainers.image.description=bumptag is a tool to increment a version and to create a git tag with an annotation"
- "--label=org.opencontainers.image.url={{ .GitURL }}"
- "--label=org.opencontainers.image.source={{ .GitURL }}"
- "--label=org.opencontainers.image.version={{ .Tag }}"
- '--label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }}'
- "--label=org.opencontainers.image.revision={{ .FullCommit }}"
- "--label=org.opencontainers.image.licenses=MIT"
- image_templates: ["svtools/{{ .ProjectName }}:{{ .Tag }}-amd64"]
dockerfile: .github/Dockerfile
use_buildx: true
goarch: amd64
build_flag_templates:
- "--label=description=bumptag is a tool to increment a version and to create a git tag with an annotation."
- "--label=version={{ .Tag }}"
- "--label=homepage=https://github.com/sv-tools/bumptag"
- "--label=commit={{ .FullCommit }}"
- "--label=date={{ .Date }}"
- "--platform=linux/amd64"
- "--label=org.opencontainers.image.title={{ .ProjectName }}"
- "--label=org.opencontainers.image.description=bumptag is a tool to increment a version and to create a git tag with an annotation"
- "--label=org.opencontainers.image.url={{ .GitURL }}"
- "--label=org.opencontainers.image.source={{ .GitURL }}"
- "--label=org.opencontainers.image.version={{ .Tag }}"
- '--label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }}'
- "--label=org.opencontainers.image.revision={{ .FullCommit }}"
- "--label=org.opencontainers.image.licenses=MIT"
- image_templates: ["svtools/{{ .ProjectName }}:{{ .Tag }}-arm64v8"]
dockerfile: .github/Dockerfile
use_buildx: true
goarch: arm64
build_flag_templates:
- "--platform=linux/arm64/v8"
- "--label=org.opencontainers.image.title={{ .ProjectName }}"
- "--label=org.opencontainers.image.description=bumptag is a tool to increment a version and to create a git tag with an annotation"
- "--label=org.opencontainers.image.url={{ .GitURL }}"
- "--label=org.opencontainers.image.source={{ .GitURL }}"
- "--label=org.opencontainers.image.version={{ .Tag }}"
- '--label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }}'
- "--label=org.opencontainers.image.revision={{ .FullCommit }}"
- "--label=org.opencontainers.image.licenses=MIT"

docker_manifests:
- name_template: "ghcr.io/sv-tools/{{ .ProjectName }}:{{ .Tag }}"
image_templates:
- "ghcr.io/sv-tools/{{ .ProjectName }}:{{ .Tag }}-amd64"
- "ghcr.io/sv-tools/{{ .ProjectName }}:{{ .Tag }}-arm64v8"
create_flags:
- --amend
- name_template: "ghcr.io/sv-tools/{{ .ProjectName }}:latest"
image_templates:
- "ghcr.io/sv-tools/{{ .ProjectName }}:{{ .Tag }}-amd64"
- "ghcr.io/sv-tools/{{ .ProjectName }}:{{ .Tag }}-arm64v8"
create_flags:
- --amend
- name_template: "ghcr.io/sv-tools/{{ .ProjectName }}:v{{ .Major }}"
image_templates:
- "ghcr.io/sv-tools/{{ .ProjectName }}:{{ .Tag }}-amd64"
- "ghcr.io/sv-tools/{{ .ProjectName }}:{{ .Tag }}-arm64v8"
create_flags:
- --amend
- name_template: "svtools/{{ .ProjectName }}:{{ .Tag }}"
image_templates:
- "svtools/{{ .ProjectName }}:{{ .Tag }}-amd64"
- "svtools/{{ .ProjectName }}:{{ .Tag }}-arm64v8"
create_flags:
- --amend
- name_template: "svtools/{{ .ProjectName }}:latest"
image_templates:
- "svtools/{{ .ProjectName }}:{{ .Tag }}-amd64"
- "svtools/{{ .ProjectName }}:{{ .Tag }}-arm64v8"
create_flags:
- --amend
- name_template: "svtools/{{ .ProjectName }}:v{{ .Major }}"
image_templates:
- "svtools/{{ .ProjectName }}:{{ .Tag }}-amd64"
- "svtools/{{ .ProjectName }}:{{ .Tag }}-arm64v8"
create_flags:
- --amend

brews:
- tap:
owner: sv-tools
name: homebrew-apps
folder: Formula
homepage: https://github.com/sv-tools/bumptag
description: bumptag is a tool to increment a version and to create a git tag with an annotation.
install: bin.install "bumptag"
test: assert_equal `#{bin}/bumptag --version`, "v#{version}"
homepage: https://github.com/sv-tools/grade
description: bumptag is a tool to increment a version and to create a git tag with an annotation
install: bin.install "{{ .ProjectName }}"
test: assert_equal `#{bin}/{{ .ProjectName }} --version`, "{{ .ProjectName }} version v#{version}"

snapcrafts:
- name_template: "{{ .ProjectName }}-{{ .Tag }}-{{ .Os }}-{{ .Arch }}{{if .Arm}}v{{.Arm}}{{end}}"
summary: bumptag is a tool to increment a version and to create a git tag with an annotation.
description: |
bumptag is a tool to increment a version and to create a git tag with an annotation.
- name_template: "{{ .ProjectName }}-{{ .Tag }}-{{ .Os }}-{{ .Arch }}"
summary: bumptag is a tool to increment a version and to create a git tag with an annotation
description: bumptag is a tool to increment a version and to create a git tag with an annotation
grade: stable
confinement: strict
publish: true
Expand Down

0 comments on commit 86ff0f4

Please sign in to comment.