Skip to content

Commit

Permalink
Adjust workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
bcessa committed Nov 9, 2020
1 parent d3938c6 commit 6a8b04a
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 28 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/ci.yml
Expand Up @@ -15,15 +15,17 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
# Go 1.14
- name: Set up Go 1.14
# Go 1.15
- name: Set up Go 1.15
uses: actions/setup-go@v2
with:
go-version: ^1.14
go-version: ^1.15

# Checkout code
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 2

# If "vendor" is in cache, restore.
# To run conditional steps use:
Expand All @@ -42,7 +44,7 @@ jobs:
- name: Static analysis
uses: golangci/golangci-lint-action@v2
with:
version: v1.29
version: v1.32

# Run unit tests
- name: Test
Expand Down
21 changes: 6 additions & 15 deletions .github/workflows/release.yml
Expand Up @@ -11,11 +11,11 @@ jobs:
timeout-minutes: 10
if: startsWith(github.ref, 'refs/tags/')
steps:
# Go 1.14
- name: Set up Go 1.14
# Go 1.15
- name: Set up Go 1.15
uses: actions/setup-go@v2
with:
go-version: ^1.14
go-version: ^1.15

# Checkout code
- name: Checkout repository
Expand All @@ -39,18 +39,6 @@ jobs:
- name: Build
run: make build-for os=linux arch=amd64

# Build and publish docker image
- name: Build and publish image
uses: docker/build-push-action@v1
with:
registry: docker.pkg.github.com
repository: ${{ github.repository }}/govanity
username: ${{ github.actor }}
password: ${{ github.token }}
push: true
tag_with_ref: true
add_git_labels: true

# Use goreleaser to create the new release
- name: Create release
uses: goreleaser/goreleaser-action@v2
Expand All @@ -59,4 +47,7 @@ jobs:
version: latest
args: release --rm-dist --skip-validate
env:
# https://docs.github.com/en/free-pro-team@latest/actions/reference/authentication-in-a-workflow
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
# Login of the user that initiated the workflow run
GITHUB_USER: ${{ github.actor }}
45 changes: 38 additions & 7 deletions .goreleaser.yml
@@ -1,10 +1,13 @@
# main project identifier
project_name: govanity
# produced artifacts are stored in this folder
dist: dist
# customize execution
before:
hooks:
- go mod download
- go generate ./...
- docker login ghcr.io -u {{ .Env.GITHUB_USER }} -p {{ .Env.GITHUB_TOKEN }}
# artifacts to produce
# https://goreleaser.com/customization/build/
builds:
Expand Down Expand Up @@ -38,30 +41,58 @@ builds:
# https://goreleaser.com/customization/archive/
archives:
# a single project can produce multiple archives
-
name_template: "govanity_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
- name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
# generate integrity checksums
# https://goreleaser.com/customization/checksum/
checksum:
name_template: 'govanity_{{ .Version }}_checksums.txt'
name_template: "{{ .ProjectName }}_{{ .Version }}_checksums.txt"
algorithm: sha256
# Include source code package on the release
# https://goreleaser.com/customization/source/
source:
enabled: false
enabled: true
# produce test releases
# https://goreleaser.com/customization/snapshots/
snapshot:
name_template: '{{ .Tag }}-next'
name_template: "{{ .Version }}-next"
# configure the 'CHANGELOG.md' file produced
# https://goreleaser.com/customization/release/#customize-the-changelog
changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
- "^docs:"
- "^test:"
- typo
# build and publish docker images
# https://goreleaser.com/customization/docker/
dockers:
-
# GOOS of the built binary that should be used
goos: linux
# GOARCH of the built binary that should be used
goarch: amd64
# Dockerfile location
dockerfile: Dockerfile
# Binaries that should be used
binaries:
- govanity
# Build IDs to gather the binaries from
builds:
- govanity
# OCI image tags
build_flag_templates:
- "--pull"
- "--label=org.opencontainers.image.title={{ .ProjectName }}"
- "--label=org.opencontainers.image.revision={{ .FullCommit }}"
- "--label=org.opencontainers.image.version={{ .Version }}"
- "--label=org.opencontainers.image.created={{ .CommitDate }}"
# Skips the docker push if there is an indicator for prerelease
# in the tag e.g. v1.0.0-rc1 (auto)
skip_push: auto
image_templates:
- "ghcr.io/bryk-io/{{ .ProjectName }}:{{ .Version }}"
- "ghcr.io/bryk-io/{{ .ProjectName }}:latest"
# Produce homebrew formulas for the project artifacts
# https://goreleaser.com/customization/homebrew/
brews:
Expand Down
2 changes: 1 addition & 1 deletion helm/govanity/Chart.yaml
Expand Up @@ -3,7 +3,7 @@ name: govanity
description: Go vanity URLs server
type: application
version: 0.1.3
appVersion: 0.1.3
appVersion: 0.1.4
home: https://github.com/bryk-io/go-vanity
icon: https://raw.githubusercontent.com/bryk-io/go-vanity/master/helm/govanity/icon.png
sources:
Expand Down
2 changes: 1 addition & 1 deletion helm/govanity/values.yaml
Expand Up @@ -6,7 +6,7 @@ nameOverride: ""
fullnameOverride: ""
imagePullSecrets: []
image:
repository: docker.pkg.github.com/bryk-io/go-vanity/govanity
repository: ghcr.io/bryk-io/govanity
pullPolicy: IfNotPresent

serviceAccount:
Expand Down

0 comments on commit 6a8b04a

Please sign in to comment.