From a6ae33c3f15ba5387309a93b32b2368795b131eb Mon Sep 17 00:00:00 2001 From: Mike Farah Date: Tue, 29 Dec 2020 09:50:21 +1100 Subject: [PATCH] Cleaning up release process, fixed github action version --- .github/workflows/release.yml | 4 +++- github-action/Dockerfile | 2 +- release_instructions.txt | 1 + scripts/publish-docker.sh | 12 ------------ scripts/release.sh | 21 --------------------- scripts/upload.sh | 28 ---------------------------- 6 files changed, 5 insertions(+), 63 deletions(-) delete mode 100755 scripts/publish-docker.sh delete mode 100755 scripts/release.sh delete mode 100755 scripts/upload.sh diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b12e6d54..168890e2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -68,7 +68,9 @@ jobs: - name: Build and push image run: | - IMAGE_VERSION="$(git describe --tags --abbrev=0)" + IMAGE_V_VERSION="$(git describe --tags --abbrev=0)" + IMAGE_VERSION=${IMAGE_V_VERSION:1} + SHORT_SHA1=$(git rev-parse --short HEAD) PLATFORMS="linux/amd64,linux/ppc64le,linux/arm64" echo "Building and pushing version ${IMAGE_VERSION} of image ${IMAGE_NAME}" diff --git a/github-action/Dockerfile b/github-action/Dockerfile index ddf7c6e5..d3839f8b 100644 --- a/github-action/Dockerfile +++ b/github-action/Dockerfile @@ -1,4 +1,4 @@ -FROM mikefarah/yq:3 +FROM mikefarah/yq:4.2.0 COPY entrypoint.sh /entrypoint.sh diff --git a/release_instructions.txt b/release_instructions.txt index 1aca267a..5e3d8bf7 100644 --- a/release_instructions.txt +++ b/release_instructions.txt @@ -1,5 +1,6 @@ - increment version in version.go - increment version in snapcraft.yaml +- increment version in github-action/Dockerfile - make sure local build passes - tag git with same version number - commit vX tag - this will trigger github actions diff --git a/scripts/publish-docker.sh b/scripts/publish-docker.sh deleted file mode 100755 index e56afd4f..00000000 --- a/scripts/publish-docker.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash -set -ex -VERSION="$(git describe --tags --abbrev=0)" -docker build \ - --target production \ - --build-arg VERSION=${VERSION} \ - -t mikefarah/yq:latest \ - -t mikefarah/yq:${VERSION} \ - -t mikefarah/yq:4 \ - . - -trivy image mikefarah/yq:${VERSION} \ No newline at end of file diff --git a/scripts/release.sh b/scripts/release.sh deleted file mode 100755 index c169aa2d..00000000 --- a/scripts/release.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -set -ex -GITHUB_TOKEN="${GITHUB_TOKEN:?missing required input \'GITHUB_TOKEN\'}" - -CURRENT="$(git describe --tags --abbrev=0)" -PREVIOUS="$(git describe --tags --abbrev=0 --always "${CURRENT}"^)" -OWNER="mikefarah" -REPO="yq" - -release() { - github-release release \ - --user "$OWNER" \ - --draft \ - --repo "$REPO" \ - --tag "$CURRENT" -} - - - -release - diff --git a/scripts/upload.sh b/scripts/upload.sh deleted file mode 100755 index 7498c2f4..00000000 --- a/scripts/upload.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash -set -ex -GITHUB_TOKEN="${GITHUB_TOKEN:?missing required input \'GITHUB_TOKEN\'}" - -CURRENT="$(git describe --tags --abbrev=0)" -PREVIOUS="$(git describe --tags --abbrev=0 --always "${CURRENT}"^)" -OWNER="mikefarah" -REPO="yq" - -upload() { - mkdir -p ./build-done - while IFS= read -r -d $'\0'; do - file=$REPLY - BINARY=$(basename "${file}") - echo "--> ${BINARY}" - github-release upload \ - --replace \ - --user "$OWNER" \ - --repo "$REPO" \ - --tag "$CURRENT" \ - --name "${BINARY}" \ - --file "$file" - mv "$file" "./build-done/${BINARY}" - done < <(find ./build -mindepth 1 -maxdepth 1 -print0) -} - - -upload