Skip to content

Commit

Permalink
Merge pull request #2317 from doitian/use-draft-release-to-package-ckb
Browse files Browse the repository at this point in the history
chore(ci): Use draft release to package CKB
  • Loading branch information
doitian authored Oct 30, 2020
2 parents fac7fb9 + 8c17d53 commit a2aa2cd
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 11 deletions.
17 changes: 10 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ script: make test
before_cache:
- rm -rf $HOME/.cargo/registry

before_deploy:
- 'export TRAVIS_TAG="${TRAVIS_BRANCH##*/}"'
- git tag $TRAVIS_TAG
deploy:
provider: releases
api_key: "$GITHUB_TOKEN"
Expand All @@ -47,12 +50,12 @@ deploy:
- "releases/ckb_${TRAVIS_TAG}_${REL_PKG}.asc"
skip_cleanup: true
overwrite: true
prerelease: true
draft: true
on:
tags: true
condition: '"$GITHUB_TOKEN" != "" && "$REL_PKG" != ""'
all_branches: true
condition: '$TRAVIS_BRANCH =~ ^pkg/'

if: 'type != pull_request or head_branch != develop'
if: 'tag IS NOT present and (type != pull_request or head_branch != develop)'

matrix:
allow_failures:
Expand Down Expand Up @@ -155,7 +158,7 @@ matrix:
- if make cov; then bash <(curl -s https://codecov.io/bash); fi

- 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
script:
Expand All @@ -164,7 +167,7 @@ matrix:
- gpg --import devtools/ci/travis-secret.asc
- devtools/ci/package.sh target/release/ckb
- 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
Expand All @@ -176,7 +179,7 @@ matrix:
- devtools/ci/package.sh target/release/ckb
- if [ -n "${QINIU_SECRET_KEY:-}" ]; then travis_wait devtools/ci/qput-7z "releases/ckb_${TRAVIS_TAG}_x86_64-unknown-linux-gnu"; fi
- 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
Expand Down
6 changes: 3 additions & 3 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ trigger:
include:
- '*'
tags:
include:
exclude:
- '*'

variables:
Expand Down Expand Up @@ -57,7 +57,7 @@ jobs:

- job: Package
timeoutInMinutes: 0
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/')
condition: startsWith(variables['Build.SourceBranch'], 'refs/heads/pkg/')
pool:
vmImage: 'windows-2019'
steps:
Expand Down Expand Up @@ -106,5 +106,5 @@ jobs:
$(Build.ArtifactStagingDirectory)/*.zip
$(Build.ArtifactStagingDirectory)/*.asc
assetUploadMode: replace
isPreRelease: true
isDraft: true
addChangeLog: false
11 changes: 10 additions & 1 deletion devtools/ci/package.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
#!/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

CKB_CLI_VERSION="${CKB_CLI_VERSION:-"$TRAVIS_TAG"}"
if [ -z "${REL_PKG:-}" ]; then
if [ "$(uname)" = Darwin ]; then
Expand All @@ -14,6 +21,8 @@ fi
PKG_NAME="ckb_${TRAVIS_TAG}_${REL_PKG%%.*}"
ARCHIVE_NAME="ckb_${TRAVIS_TAG}_${REL_PKG}"

echo "ARCHIVE_NAME=$ARCHIVE_NAME"

rm -rf releases
mkdir releases

Expand Down

0 comments on commit a2aa2cd

Please sign in to comment.