-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
goreleaser configuration and automatic release workflow
- Loading branch information
Showing
3 changed files
with
114 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: release | ||
on: | ||
push: | ||
tags: | ||
- "v*" | ||
jobs: | ||
goreleaser: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- uses: actions/setup-go@v2 | ||
with: | ||
go-version: "1.16.x" | ||
|
||
- uses: docker/setup-qemu-action@v1 | ||
- uses: docker/setup-buildx-action@v1 | ||
- uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKCERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKCERHUB_TOKEN }} | ||
|
||
- uses: goreleaser/goreleaser-action@v2 | ||
with: | ||
version: latest | ||
args: release --rm-dist | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
SOURCE: "file go_bindata github github_ee bitbucket aws_s3 google_cloud_storage godoc_vfs gitlab" | ||
DATABASE: "postgres mysql redshift cassandra spanner cockroachdb clickhouse mongodb sqlserver firebird neo4j pgx" | ||
|
||
- run: gem install package_cloud | ||
- run: package_cloud push golang-migrate/migrate/ubuntu/bionic dist/migrate.linux-amd64.deb | ||
env: | ||
PACKAGECLOUD_TOKEN: ${{ secrets.PACKAGECLOUD_TOKEN }} | ||
- run: package_cloud push golang-migrate/migrate/ubuntu/focal dist/migrate.linux-amd64.deb | ||
env: | ||
PACKAGECLOUD_TOKEN: ${{ secrets.PACKAGECLOUD_TOKEN }} | ||
- run: package_cloud push golang-migrate/migrate/debian/buster dist/migrate.linux-amd64.deb | ||
env: | ||
PACKAGECLOUD_TOKEN: ${{ secrets.PACKAGECLOUD_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,4 +6,5 @@ cli/migrate | |
.godoc.pid | ||
vendor/ | ||
.vscode/ | ||
.idea/ | ||
.idea | ||
dist/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
project_name: migrate | ||
before: | ||
hooks: | ||
- go mod tidy | ||
builds: | ||
- env: | ||
- CGO_ENABLED=0 | ||
goos: | ||
- linux | ||
- windows | ||
- darwin | ||
goarch: | ||
- amd64 | ||
- arm | ||
- arm64 | ||
- 386 | ||
goarm: | ||
- 7 | ||
main: ./cmd/migrate | ||
ldflags: | ||
- '-w -s -X main.Version={{ .Version }} -extldflags "static"' | ||
flags: | ||
- "-tags={{ .Env.DATABASE }}{{ .Env.SOURCE }}" | ||
- "-trimpath" | ||
ignore: | ||
- goos: windows | ||
goarch: arm | ||
nfpms: | ||
- homepage: "https://github.com/golang-migrate/migrate" | ||
maintainer: "[email protected]" | ||
license: MIT | ||
description: "Database migrations" | ||
formats: | ||
- deb | ||
file_name_template: "{{ .ProjectName }}.{{ .Os }}-{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}" | ||
dockers: | ||
- goarch: amd64 | ||
use_buildx: true | ||
image_templates: | ||
- 'migrate/migrate:{{ .Tag }}' | ||
build_flag_templates: | ||
- '--label=org.opencontainers.image.created={{ .Date }}' | ||
- '--label=org.opencontainers.image.title={{ .ProjectName }}' | ||
- '--label=org.opencontainers.image.revision={{ .FullCommit }}' | ||
- '--label=org.opencontainers.image.version={{ .Version }}' | ||
- "--label=org.opencontainers.image.source={{ .GitURL }}" | ||
- "--platform=linux/amd64" | ||
dockerfile: Dockerfile | ||
- goarch: arm64 | ||
use_buildx: true | ||
image_templates: | ||
- 'migrate/migrate:{{ .Tag }}' | ||
build_flag_templates: | ||
- '--label=org.opencontainers.image.created={{ .Date }}' | ||
- '--label=org.opencontainers.image.title={{ .ProjectName }}' | ||
- '--label=org.opencontainers.image.revision={{ .FullCommit }}' | ||
- '--label=org.opencontainers.image.version={{ .Version }}' | ||
- "--label=org.opencontainers.image.source={{ .GitURL }}" | ||
- "--platform=linux/arm64" | ||
dockerfile: Dockerfile | ||
archives: | ||
- name_template: "{{ .ProjectName }}.{{ .Os }}-{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}" | ||
checksum: | ||
name_template: 'sha256sum.txt' | ||
release: | ||
draft: true | ||
changelog: | ||
skip: true | ||
snapshot: | ||
name_template: "{{ .Tag }}-next" |