diff --git a/.drone.star b/.drone.star index 8da71f5..a487361 100644 --- a/.drone.star +++ b/.drone.star @@ -87,10 +87,9 @@ def linux(arch): 'image': 'golang:1.12', 'environment': { 'CGO_ENABLED': '0', - 'BUILD_VERSION': '${DRONE_TAG##v}' }, 'commands': [ - '[ -z "${BUILD_VERSION}" ] && BUILD_VERSION=${DRONE_COMMIT_SHA:0:8}', + '[ -z "${DRONE_TAG}" ] && BUILD_VERSION=${DRONE_COMMIT_SHA:0:8} || BUILD_VERSION=${DRONE_TAG##v}', 'go build -v -ldflags "-X main.Version=$BUILD_VERSION" -a -tags netgo -o release/%s/github-releases-notifier' % arch ], }, @@ -99,7 +98,6 @@ def linux(arch): 'image': 'golang:1.12', 'commands': [ './release/%s/github-releases-notifier --help' % arch, - './release/%s/github-releases-notifier --version' % arch ] }, { @@ -166,11 +164,8 @@ def binaries(arch): { 'name': 'build', 'image': 'techknowlogick/xgo:latest', - 'environment': { - 'BUILD_VERSION': '${DRONE_TAG##v}' - }, 'commands': [ - '[ -z "${BUILD_VERSION}" ] && BUILD_VERSION=${DRONE_COMMIT_SHA:0:8}', + '[ -z "${DRONE_TAG}" ] && BUILD_VERSION=${DRONE_COMMIT_SHA:0:8} || BUILD_VERSION=${DRONE_TAG##v}', 'mkdir -p release/', "xgo -ldflags \"-X main.Version=$BUILD_VERSION\" -tags netgo -targets 'linux/amd64,linux/arm-6,linux/arm64' -out github-releases-notifier-$BUILD_VERSION .", 'cp /build/* release/', @@ -182,7 +177,6 @@ def binaries(arch): 'image': 'alpine', 'commands': [ 'cd release/ && sha256sum * > sha256sum.txt', - 'cat sha256sum.txt' ], }, { diff --git a/.drone.yml b/.drone.yml index 642198f..1ac14fc 100644 --- a/.drone.yml +++ b/.drone.yml @@ -47,17 +47,15 @@ steps: - name: build image: golang:1.12 commands: - - "[ -z \"${BUILD_VERSION}\" ] && BUILD_VERSION=${DRONE_COMMIT_SHA:0:8}" + - "[ -z \"${DRONE_TAG}\" ] && BUILD_VERSION=${DRONE_COMMIT_SHA:0:8} || BUILD_VERSION=${DRONE_TAG##v}" - go build -v -ldflags "-X main.Version=$BUILD_VERSION" -a -tags netgo -o release/amd64/github-releases-notifier environment: - BUILD_VERSION: ${DRONE_TAG##v} CGO_ENABLED: 0 - name: executable image: golang:1.12 commands: - ./release/amd64/github-releases-notifier --help - - ./release/amd64/github-releases-notifier --version - name: dryrun image: plugins/docker @@ -112,17 +110,15 @@ steps: - name: build image: golang:1.12 commands: - - "[ -z \"${BUILD_VERSION}\" ] && BUILD_VERSION=${DRONE_COMMIT_SHA:0:8}" + - "[ -z \"${DRONE_TAG}\" ] && BUILD_VERSION=${DRONE_COMMIT_SHA:0:8} || BUILD_VERSION=${DRONE_TAG##v}" - go build -v -ldflags "-X main.Version=$BUILD_VERSION" -a -tags netgo -o release/arm64/github-releases-notifier environment: - BUILD_VERSION: ${DRONE_TAG##v} CGO_ENABLED: 0 - name: executable image: golang:1.12 commands: - ./release/arm64/github-releases-notifier --help - - ./release/arm64/github-releases-notifier --version - name: dryrun image: plugins/docker @@ -177,17 +173,15 @@ steps: - name: build image: golang:1.12 commands: - - "[ -z \"${BUILD_VERSION}\" ] && BUILD_VERSION=${DRONE_COMMIT_SHA:0:8}" + - "[ -z \"${DRONE_TAG}\" ] && BUILD_VERSION=${DRONE_COMMIT_SHA:0:8} || BUILD_VERSION=${DRONE_TAG##v}" - go build -v -ldflags "-X main.Version=$BUILD_VERSION" -a -tags netgo -o release/arm/github-releases-notifier environment: - BUILD_VERSION: ${DRONE_TAG##v} CGO_ENABLED: 0 - name: executable image: golang:1.12 commands: - ./release/arm/github-releases-notifier --help - - ./release/arm/github-releases-notifier --version - name: dryrun image: plugins/docker @@ -242,19 +236,16 @@ steps: - name: build image: techknowlogick/xgo:latest commands: - - "[ -z \"${BUILD_VERSION}\" ] && BUILD_VERSION=${DRONE_COMMIT_SHA:0:8}" + - "[ -z \"${DRONE_TAG}\" ] && BUILD_VERSION=${DRONE_COMMIT_SHA:0:8} || BUILD_VERSION=${DRONE_TAG##v}" - mkdir -p release/ - xgo -ldflags "-X main.Version=$BUILD_VERSION" -tags netgo -targets 'linux/amd64,linux/arm-6,linux/arm64' -out github-releases-notifier-$BUILD_VERSION . - cp /build/* release/ - ls -lah release/ - environment: - BUILD_VERSION: ${DRONE_TAG##v} - name: checksum image: alpine commands: - cd release/ && sha256sum * > sha256sum.txt - - cat sha256sum.txt - name: publish image: plugins/github-release @@ -353,6 +344,6 @@ depends_on: --- kind: signature -hmac: dfd7579768ef56661e69f51498b32a2cedc72869c01876711963f7f9b8d76fc4 +hmac: db1cd58f6fe402fec379a32614bbda189901ac1b80e92fa20a552bd69eddff20 ... diff --git a/CHANGELOG.md b/CHANGELOG.md index 3472972..7d2000e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ - FEATURE - add env variable `GITHUB_REPOS` - add env variable `IGNORE_PRE` +- BUGFIX + - add `required` flag for GitHub token and Slack hook - INTERNAL - provide also binary releases - switch to gomod instead of vendor folder