BUG: "dnscontrol version" not working (#2356)

Co-authored-by: Tom Limoncelli <tal@whatexit.org>
This commit is contained in:
Tom Limoncelli 2023-05-12 10:52:31 -04:00 committed by GitHub
parent d7a87f6e2a
commit 3d1cd30a1d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 42 additions and 6 deletions

View file

@ -10,7 +10,7 @@ jobs:
build:
runs-on: ubuntu-latest
container:
image: golang:1.18
image: golang:1.20
env:
TEST_RESULTS: "/tmp/test-results"
steps:
@ -33,12 +33,28 @@ jobs:
- uses: actions/upload-artifact@v3.1.2
with:
path: "/tmp/test-results"
# For some reason goreleaser isn't correctly setting the version
# string used by "dnscontrol version". Therefore, we're forcing the
# string using the GORELEASER_CURRENT_TAG feature.
# TODO(tlim): Use the native gorelease version mechanism.
- name: Retrieve version
id: version
run: |
echo "TAG_NAME=$(git config --global --add safe.directory /__w/dnscontrol/dnscontrol ; git describe)" >> $GITHUB_OUTPUT
- name: Reveal version
run: echo ${{ steps.version.outputs.TAG_NAME }}
- name: Build binaries (if tagged)
if: github.ref_type == 'tag'
run: goreleaser build
env:
GORELEASER_CURRENT_TAG: ${{ steps.version.outputs.TAG_NAME }}
- name: Build binaries (not tagged)
if: github.ref_type != 'tag'
run: goreleaser build --snapshot
env:
GORELEASER_CURRENT_TAG: ${{ steps.version.outputs.TAG_NAME }}
integration-test-providers:
needs: build
runs-on: ubuntu-latest
@ -70,7 +86,7 @@ jobs:
needs: integration-test-providers
runs-on: ubuntu-latest
container:
image: golang:1.18
image: golang:1.20
env:
TEST_RESULTS: "/tmp/test-results"
GOTESTSUM_FORMAT: testname
@ -171,7 +187,7 @@ jobs:
if: github.ref != 'refs/heads/master' && github.ref != 'refs/heads/main'
runs-on: ubuntu-latest
container:
image: golang:1.18
image: golang:1.20
needs:
- integration-test-providers
- integrtests-diff1

View file

@ -25,12 +25,26 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: ^1.15
go-version: ^1.20
- name: Install goreleaser
run: go install github.com/goreleaser/goreleaser@latest
# For some reason goreleaser isn't correctly setting the version
# string used by "dnscontrol version". Therefore, we're forcing the
# string using the GORELEASER_CURRENT_TAG feature.
# TODO(tlim): Use the native gorelease version mechanism.
- name: Retrieve version
id: version
run: |
echo "TAG_NAME=$(git config --global --add safe.directory /__w/dnscontrol/dnscontrol ; git describe --tags)" >> $GITHUB_OUTPUT
- name: Reveal version
run: echo ${{ steps.version.outputs.TAG_NAME }}
- name: Goreleaser release
run: goreleaser release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GORELEASER_CURRENT_TAG: ${{ steps.version.outputs.TAG_NAME }}

View file

@ -23,7 +23,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: ^1.15
go-version: ^1.20
- name: Build binaries
run: go run build/build.go

View file

@ -22,7 +22,13 @@ const (
)
var commands = []*cli.Command{}
var version string
// These are set by/for goreleaser
var (
version = "dev"
commit = "none"
date = "unknown"
)
func cmd(cat string, c *cli.Command) bool {
c.Category = cat