diff --git a/Makefile b/Makefile index 9c2c313..3ee7c87 100644 --- a/Makefile +++ b/Makefile @@ -65,6 +65,58 @@ build-all: clean build-linux-386 build-linux-amd64 build-linux-arm build-linux-a build-darwin-arm64 build-windows-386 build-windows-amd64 build-windows-arm build-windows-arm64 \ build-install build-version +release-new: + keygen new --name "Keygen Relay v$(PACKAGE_VERSION)" --channel ${PACKAGE_CHANNEL} --version ${PACKAGE_VERSION} + +release-linux-386: + keygen upload build/relay_linux_386 --release ${PACKAGE_VERSION} --platform linux --arch 386 + +release-linux-amd64: + keygen upload build/relay_linux_amd64 --release ${PACKAGE_VERSION} --platform linux --arch amd64 + +release-linux-arm: + keygen upload build/relay_linux_arm --release ${PACKAGE_VERSION} --platform linux --arch arm + +release-linux-arm64: + keygen upload build/relay_linux_arm64 --release ${PACKAGE_VERSION} --platform linux --arch arm64 + +release-darwin-amd64: + keygen upload build/relay_darwin_amd64 --release ${PACKAGE_VERSION} --platform darwin --arch amd64 + +release-darwin-arm64: + keygen upload build/relay_darwin_arm64 --release ${PACKAGE_VERSION} --platform darwin --arch arm64 + +release-windows-386: + keygen upload build/relay_windows_386.exe --release ${PACKAGE_VERSION} --platform windows --arch 386 + +release-windows-amd64: + keygen upload build/relay_windows_amd64.exe --release ${PACKAGE_VERSION} --platform windows --arch amd64 + +release-windows-arm: + keygen upload build/relay_windows_arm.exe --release ${PACKAGE_VERSION} --platform windows --arch arm + +release-windows-arm64: + keygen upload build/relay_windows_arm64.exe --release ${PACKAGE_VERSION} --platform windows --arch arm64 + +release-installer: + keygen upload build/install.sh --release ${PACKAGE_VERSION} + +release-version: + keygen upload build/version --release ${PACKAGE_VERSION} --filetype txt + +release-publish: + keygen publish --release ${PACKAGE_VERSION} + +release-tag: + ifeq ($(PACKAGE_CHANNEL),stable) + keygen untag --release latest + keygen tag latest --release ${PACKAGE_VERSION} + endif + +release: release-new release-linux-386 release-linux-amd64 release-linux-arm release-linux-arm64 release-darwin-amd64 \ + release-darwin-arm64 release-windows-386 release-windows-amd64 release-windows-arm release-windows-arm64 \ + release-installer release-version release-publish release-tag + test: go test -race ./... diff --git a/scripts/publish.sh b/scripts/publish.sh deleted file mode 100755 index 841651f..0000000 --- a/scripts/publish.sh +++ /dev/null @@ -1,114 +0,0 @@ -#!/bin/bash - -log_info() { - echo "[info] $1" -} - -log_warn() { - echo "[warn] $1" -} - -log_err() { - echo "[error] $1" - exit 1 -} - -main() { - log_info "drafting v${VERSION}" - - # draft new version - keygen new \ - --name "Keygen Relay v${VERSION}" \ - --channel "${CHANNEL}" \ - --version "${VERSION}" - - if [ $? -eq 0 ] - then - log_info "successfully drafted v${VERSION}" - else - log_err "failed to draft v${VERSION}" - fi - - # upload artifact for each dist platform - for filename in $(ls dist/relay_*) - do - IFS='_' read -r _ platform arch <<< "$filename" - - log_info "uploading v${VERSION} for ${platform}/${arch}: ${filename}" - - keygen upload "build/${filename}" \ - --release "${VERSION}" \ - --platform "${platform}" \ - --arch "${arch}" - - if [ $? -eq 0 ] - then - log_info "successfully uploading v${VERSION} for ${platform}/${arch}" - else - log_err "failed to upload v${VERSION} for ${platform}/${arch}" - fi - done - - # upload installer - keygen upload 'build/install.sh' --release "${VERSION}" - - # upload version - keygen upload 'build/version' \ - --release "${VERSION}" \ - --filetype 'txt' - - # publish version - keygen publish --release "${VERSION}" - - if [ $? -eq 0 ] - then - log_info "successfully published v${VERSION}" - else - log_err "failed to publish v${VERSION}" - fi - - # we only want to do the rest for stable releases - if [ "${CHANNEL}" = 'stable' ] - then - # untag previous latest if it exists (we'll continue even on failure) - keygen untag --release 'latest' - - if [ $? -eq 0 ] - then - log_info "successfully untagged v${VERSION}" - else - log_warn "failed to untag v${VERSION}" - fi - - # tag as latest - keygen tag 'latest' --release "${VERSION}" - - if [ $? -eq 0 ] - then - log_info "successfully tagged v${VERSION}" - else - log_err "failed to tag v${VERSION}" - fi - fi -} - -VERSION="$(cat VERSION)" -CHANNEL='stable' - -case "${VERSION}" -in - *-rc.*) - CHANNEL='rc' - ;; - *-beta.*) - CHANNEL='beta' - ;; - *-alpha.*) - CHANNEL='alpha' - ;; - *-dev.*) - CHANNEL='dev' - ;; -esac - -main