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

Commit

Permalink
update: releaser script
Browse files Browse the repository at this point in the history
  • Loading branch information
sysatom committed Jun 2, 2021
1 parent 589dcdd commit 420ad73
Show file tree
Hide file tree
Showing 15 changed files with 155 additions and 55 deletions.
22 changes: 11 additions & 11 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
- name: Build and push cron
uses: docker/build-push-action@v2
with:
context: .
context: ./dist/cron_linux_amd64
push: true
file: build/cron/Dockerfile
tags: |
Expand All @@ -57,7 +57,7 @@ jobs:
- name: Build and push gateway
uses: docker/build-push-action@v2
with:
context: .
context: ./dist/gateway_linux_amd64
push: true
file: build/gateway/Dockerfile
tags: |
Expand All @@ -67,7 +67,7 @@ jobs:
- name: Build and push message
uses: docker/build-push-action@v2
with:
context: .
context: ./dist/message_linux_amd64
push: true
file: build/message/Dockerfile
tags: |
Expand All @@ -77,7 +77,7 @@ jobs:
- name: Build and push middle
uses: docker/build-push-action@v2
with:
context: .
context: ./dist/middle_linux_amd64
push: true
file: build/middle/Dockerfile
tags: |
Expand All @@ -87,7 +87,7 @@ jobs:
- name: Build and push spider
uses: docker/build-push-action@v2
with:
context: .
context: ./dist/spider_linux_amd64
push: true
file: build/spider/Dockerfile
tags: |
Expand All @@ -97,7 +97,7 @@ jobs:
- name: Build and push storage
uses: docker/build-push-action@v2
with:
context: .
context: ./dist/storage_linux_amd64
push: true
file: build/storage/Dockerfile
tags: |
Expand All @@ -107,7 +107,7 @@ jobs:
- name: Build and push subscribe
uses: docker/build-push-action@v2
with:
context: .
context: ./dist/subscribe_linux_amd64
push: true
file: build/subscribe/Dockerfile
tags: |
Expand All @@ -117,7 +117,7 @@ jobs:
- name: Build and push task
uses: docker/build-push-action@v2
with:
context: .
context: ./dist/task_linux_amd64
push: true
file: build/task/Dockerfile
tags: |
Expand All @@ -127,7 +127,7 @@ jobs:
- name: Build and push web
uses: docker/build-push-action@v2
with:
context: .
context: ./dist/web_linux_amd64
push: true
file: build/web/Dockerfile
tags: |
Expand All @@ -137,7 +137,7 @@ jobs:
- name: Build and push worker
uses: docker/build-push-action@v2
with:
context: .
context: ./dist/worker_linux_amd64
push: true
file: build/worker/Dockerfile
tags: |
Expand All @@ -147,7 +147,7 @@ jobs:
- name: Build and push workflow
uses: docker/build-push-action@v2
with:
context: .
context: ./dist/workflow_linux_amd64
push: true
file: build/workflow/Dockerfile
tags: |
Expand Down
12 changes: 12 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,18 @@ jobs:
uses: actions/checkout@v2
with:
fetch-depth: 0
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Set up Go
uses: actions/setup-go@v2
Expand Down
149 changes: 120 additions & 29 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# This is an example .goreleaser.yml file with some sane defaults.
# Make sure to check the documentation at http://goreleaser.com
# the documentation at http://goreleaser.com
before:
hooks:
# You may remove this if you don't use go modules.
- go mod download

env:
- CGO_ENABLED=0

builds:
# app
- main: ./cmd/cron
Expand All @@ -14,8 +15,6 @@ builds:
- linux
goarch:
- amd64
env:
- CGO_ENABLED=0
ldflags:
- -s -w -X github.com/tsundata/assistant/internal/pkg/version.Version={{ .Version }}
-X github.com/tsundata/assistant/internal/pkg/version.GitCommit={{ .ShortCommit }}
Expand All @@ -29,8 +28,6 @@ builds:
- linux
goarch:
- amd64
env:
- CGO_ENABLED=0
ldflags:
- -s -w -X github.com/tsundata/assistant/internal/pkg/version.Version={{ .Version }}
-X github.com/tsundata/assistant/internal/pkg/version.GitCommit={{ .ShortCommit }}
Expand All @@ -44,8 +41,6 @@ builds:
- linux
goarch:
- amd64
env:
- CGO_ENABLED=0
ldflags:
- -s -w -X github.com/tsundata/assistant/internal/pkg/version.Version={{ .Version }}
-X github.com/tsundata/assistant/internal/pkg/version.GitCommit={{ .ShortCommit }}
Expand All @@ -59,8 +54,6 @@ builds:
- linux
goarch:
- amd64
env:
- CGO_ENABLED=0
ldflags:
- -s -w -X github.com/tsundata/assistant/internal/pkg/version.Version={{ .Version }}
-X github.com/tsundata/assistant/internal/pkg/version.GitCommit={{ .ShortCommit }}
Expand All @@ -74,8 +67,6 @@ builds:
- linux
goarch:
- amd64
env:
- CGO_ENABLED=0
ldflags:
- -s -w -X github.com/tsundata/assistant/internal/pkg/version.Version={{ .Version }}
-X github.com/tsundata/assistant/internal/pkg/version.GitCommit={{ .ShortCommit }}
Expand All @@ -89,8 +80,6 @@ builds:
- linux
goarch:
- amd64
env:
- CGO_ENABLED=0
ldflags:
- -s -w -X github.com/tsundata/assistant/internal/pkg/version.Version={{ .Version }}
-X github.com/tsundata/assistant/internal/pkg/version.GitCommit={{ .ShortCommit }}
Expand All @@ -104,8 +93,6 @@ builds:
- linux
goarch:
- amd64
env:
- CGO_ENABLED=0
ldflags:
- -s -w -X github.com/tsundata/assistant/internal/pkg/version.Version={{ .Version }}
-X github.com/tsundata/assistant/internal/pkg/version.GitCommit={{ .ShortCommit }}
Expand All @@ -119,8 +106,6 @@ builds:
- linux
goarch:
- amd64
env:
- CGO_ENABLED=0
ldflags:
- -s -w -X github.com/tsundata/assistant/internal/pkg/version.Version={{ .Version }}
-X github.com/tsundata/assistant/internal/pkg/version.GitCommit={{ .ShortCommit }}
Expand All @@ -134,8 +119,6 @@ builds:
- linux
goarch:
- amd64
env:
- CGO_ENABLED=0
ldflags:
- -s -w -X github.com/tsundata/assistant/internal/pkg/version.Version={{ .Version }}
-X github.com/tsundata/assistant/internal/pkg/version.GitCommit={{ .ShortCommit }}
Expand All @@ -149,8 +132,6 @@ builds:
- linux
goarch:
- amd64
env:
- CGO_ENABLED=0
ldflags:
- -s -w -X github.com/tsundata/assistant/internal/pkg/version.Version={{ .Version }}
-X github.com/tsundata/assistant/internal/pkg/version.GitCommit={{ .ShortCommit }}
Expand All @@ -164,8 +145,6 @@ builds:
- linux
goarch:
- amd64
env:
- CGO_ENABLED=0
ldflags:
- -s -w -X github.com/tsundata/assistant/internal/pkg/version.Version={{ .Version }}
-X github.com/tsundata/assistant/internal/pkg/version.GitCommit={{ .ShortCommit }}
Expand All @@ -180,8 +159,6 @@ builds:
- linux
goarch:
- amd64
env:
- CGO_ENABLED=0
ldflags:
- -s -w -X github.com/tsundata/assistant/internal/pkg/version.Version={{ .Version }}
-X github.com/tsundata/assistant/internal/pkg/version.GitCommit={{ .ShortCommit }}
Expand All @@ -195,21 +172,133 @@ builds:
- linux
goarch:
- amd64
env:
- CGO_ENABLED=0
ldflags:
- -s -w -X github.com/tsundata/assistant/internal/pkg/version.Version={{ .Version }}
-X github.com/tsundata/assistant/internal/pkg/version.GitCommit={{ .ShortCommit }}
-X github.com/tsundata/assistant/internal/pkg/version.BuildTime={{ .Timestamp }}
-X github.com/tsundata/assistant/internal/pkg/version.GoVersion={{ replace .Env.GOVERSION " " "_" }}

dockers:
- goos: linux
goarch: amd64
ids:
- cron
use_buildx: true
image_templates:
- "tsundata/cron:latest"
- "tsundata/cron:{{ .Tag }}"
dockerfile: build/cron/Dockerfile

- goos: linux
goarch: amd64
ids:
- gateway
use_buildx: true
image_templates:
- "tsundata/gateway:latest"
- "tsundata/gateway:{{ .Tag }}"
dockerfile: build/gateway/Dockerfile

- goos: linux
goarch: amd64
ids:
- message
use_buildx: true
image_templates:
- "tsundata/message:latest"
- "tsundata/message:{{ .Tag }}"
dockerfile: build/message/Dockerfile

- goos: linux
goarch: amd64
ids:
- middle
use_buildx: true
image_templates:
- "tsundata/middle:latest"
- "tsundata/middle:{{ .Tag }}"
dockerfile: build/middle/Dockerfile

- goos: linux
goarch: amd64
ids:
- spider
use_buildx: true
image_templates:
- "tsundata/spider:latest"
- "tsundata/spider:{{ .Tag }}"
dockerfile: build/spider/Dockerfile

- goos: linux
goarch: amd64
ids:
- storage
use_buildx: true
image_templates:
- "tsundata/storage:latest"
- "tsundata/storage:{{ .Tag }}"
dockerfile: build/storage/Dockerfile

- goos: linux
goarch: amd64
ids:
- subscribe
use_buildx: true
image_templates:
- "tsundata/subscribe:latest"
- "tsundata/subscribe:{{ .Tag }}"
dockerfile: build/subscribe/Dockerfile

- goos: linux
goarch: amd64
ids:
- task
use_buildx: true
image_templates:
- "tsundata/task:latest"
- "tsundata/task:{{ .Tag }}"
dockerfile: build/task/Dockerfile

- goos: linux
goarch: amd64
ids:
- web
use_buildx: true
image_templates:
- "tsundata/web:latest"
- "tsundata/web:{{ .Tag }}"
dockerfile: build/web/Dockerfile

- goos: linux
goarch: amd64
ids:
- worker
use_buildx: true
image_templates:
- "tsundata/worker:latest"
- "tsundata/worker:{{ .Tag }}"
dockerfile: build/worker/Dockerfile

- goos: linux
goarch: amd64
ids:
- workflow
use_buildx: true
image_templates:
- "tsundata/workflow:latest"
- "tsundata/workflow:{{ .Tag }}"
dockerfile: build/workflow/Dockerfile

archives:
- format: binary
name_template: "{{ .Binary }}-{{ .Os }}-{{ .Arch }}"

checksum:
name_template: 'checksums.txt'

snapshot:
name_template: "SNAPSHOT-{{ .ShortCommit }}"

changelog:
sort: desc
filters:
Expand All @@ -219,8 +308,10 @@ changelog:
- '^merge:'
- '^Merge pull request'
- '^Merge branch'

env_files:
github_token: ~/.gh_token

release:
github:
owner: tsundata
Expand Down
Loading

0 comments on commit 420ad73

Please sign in to comment.