diff --git a/.travis.yml b/.travis.yml index 99ccbcb2..5710d071 100644 --- a/.travis.yml +++ b/.travis.yml @@ -38,6 +38,9 @@ before_cache: - rm -rf ./target/debug/incremental/ - cargo sweep -f +before_deploy: + - 'export TRAVIS_TAG="${TRAVIS_BRANCH##*/}"' + - git tag $TRAVIS_TAG deploy: provider: releases api_key: "$GITHUB_TOKEN" @@ -45,11 +48,11 @@ deploy: - "releases/ckb-cli_${TRAVIS_TAG}_${REL_PKG}" - "releases/ckb-cli_${TRAVIS_TAG}_${REL_PKG}.asc" skip_cleanup: true - prerelease: true + draft: true overwrite: true on: - tags: true - condition: '"$GITHUB_TOKEN" != "" && "$REL_PKG" != ""' + all_branches: true + condition: '$TRAVIS_BRANCH =~ ^pkg/' matrix: include: @@ -82,7 +85,7 @@ matrix: script: make integration - name: Package for macOS - if: 'tag IS present AND env(GITHUB_TOKEN) IS present' + if: 'branch =~ /^pkg\// AND env(GITHUB_TOKEN) IS present' os: osx env: REL_PKG=x86_64-apple-darwin.zip before_install: skip @@ -97,7 +100,7 @@ matrix: - gpg --import devtools/ci/travis-secret.asc - devtools/ci/package.sh target/release/ckb-cli - name: Package for Linux - if: 'tag IS present AND env(GITHUB_TOKEN) IS present' + if: 'branch =~ /^pkg\// AND env(GITHUB_TOKEN) IS present' language: ruby addons: { apt: { packages: [] } } env: REL_PKG=x86_64-unknown-linux-gnu.tar.gz BUILDER_IMAGE=nervos/ckb-docker-builder:xenial-rust-1.46.0 @@ -113,7 +116,7 @@ matrix: - gpg --import devtools/ci/travis-secret.asc - devtools/ci/package.sh target/release/ckb-cli - name: Package for Centos - if: 'tag IS present AND env(GITHUB_TOKEN) IS present' + if: 'branch =~ /^pkg\// AND env(GITHUB_TOKEN) IS present' language: ruby addons: { apt: { packages: [] } } env: REL_PKG=x86_64-unknown-centos-gnu.tar.gz BUILDER_IMAGE=nervos/ckb-docker-builder:centos-7-rust-1.46.0 diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 435f9eca..4c3ff2aa 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -3,7 +3,7 @@ trigger: include: - '*' tags: - include: + exclude: - '*' jobs: @@ -29,7 +29,7 @@ jobs: - job: Package timeoutInMinutes: 0 - condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/') + condition: startsWith(variables['Build.SourceBranch'], 'refs/heads/pkg/') pool: vmImage: 'VS2017-Win2016' steps: @@ -71,5 +71,5 @@ jobs: $(Build.ArtifactStagingDirectory)/*.zip $(Build.ArtifactStagingDirectory)/*.asc assetUploadMode: replace - isPreRelease: true + isDraft: true addChangeLog: false diff --git a/devtools/ci/package.sh b/devtools/ci/package.sh index b3b0b5f6..97cd11ad 100755 --- a/devtools/ci/package.sh +++ b/devtools/ci/package.sh @@ -1,7 +1,13 @@ #!/bin/bash set -eu -TRAVIS_TAG="${TRAVIS_TAG:-"$(git describe)"}" +if [ -z "${TRAVIS_TAG:-}" ]; then + if [ -n "${TRAVIS_BRANCH}" ]; then + TRAVIS_TAG="${TRAVIS_BRANCH##*/}" + else + TRAVIS_TAG="$(git describe)" + fi +fi if [ -z "${REL_PKG:-}" ]; then if [ "$(uname)" = Darwin ]; then REL_PKG=x86_64-apple-darwin.zip @@ -13,6 +19,8 @@ fi PKG_NAME="ckb-cli_${TRAVIS_TAG}_${REL_PKG%%.*}" ARCHIVE_NAME="ckb-cli_${TRAVIS_TAG}_${REL_PKG}" +echo "ARCHIVE_NAME=$ARCHIVE_NAME" + rm -rf releases mkdir releases