From 5e05e0d21f8ed2dc9f3d1ae857156e831c6acfe0 Mon Sep 17 00:00:00 2001 From: cipchk Date: Thu, 14 Mar 2024 19:10:49 +0800 Subject: [PATCH 1/2] ci: fix upload to delon-builds when push --- .github/workflows/ci.yml | 1 + scripts/ci/build-artifacts.sh | 21 +++++++-------------- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4a0460400..82edb3117 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,6 +33,7 @@ jobs: env: ACCESS_TOKEN: ${{ secrets.CI_TOKEN }} MESSAGE: ${{ github.event.pull_request.title || github.event.head_commit.message }} + BRANCH: ${GITHUB_REF##*/} - name: Build site run: yarn run site:build - name: 'Deploy Site' diff --git a/scripts/ci/build-artifacts.sh b/scripts/ci/build-artifacts.sh index 1fd8e5886..fa0efa390 100755 --- a/scripts/ci/build-artifacts.sh +++ b/scripts/ci/build-artifacts.sh @@ -2,6 +2,12 @@ set -e +if [ -z ${ACCESS_TOKEN} ]; then + echo "Error: No access token for GitHub could be found." \ + "Please set the environment variable 'ACCESS_TOKEN'." + exit 0 +fi + readonly thisDir=$(cd $(dirname $0); pwd) commitSha=$(git rev-parse --short HEAD) @@ -17,19 +23,6 @@ cd $(dirname $0)/../.. DIST="$(pwd)/dist" -# if [[ ${commitAuthorName} != '卡色' && ${commitAuthorName} != 'cipchk' ]]; then -# echo "Warning: Just only 卡色 or cipchk user" -# exit 0 -# fi - -# echo "ACCESS_TOKEN: ${ACCESS_TOKEN}.." - -if [ -z ${ACCESS_TOKEN} ]; then - echo "Error: No access token for GitHub could be found." \ - "Please set the environment variable 'ACCESS_TOKEN'." - exit 0 -fi - buildDir=${DIST}/publish rm -rf ${buildDir} mkdir -p ${buildDir} @@ -38,7 +31,7 @@ cp -r ${DIST}/ng-alain ${buildDir}/ng-alain packageRepo=delon-builds buildVersion=$(node -pe "require('./package.json').version") -branchName=${TRAVIS_BRANCH:-'master'} +branchName=${BRANCH:-'master'} buildVersionName="${buildVersion}-${commitSha}" buildTagName="${branchName}-${commitSha}" From df17b04c5771f0e58d443bae9469b2e19ac6543a Mon Sep 17 00:00:00 2001 From: cipchk Date: Thu, 14 Mar 2024 19:20:40 +0800 Subject: [PATCH 2/2] ci: fix --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 82edb3117..b51bd9e75 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,7 +33,7 @@ jobs: env: ACCESS_TOKEN: ${{ secrets.CI_TOKEN }} MESSAGE: ${{ github.event.pull_request.title || github.event.head_commit.message }} - BRANCH: ${GITHUB_REF##*/} + BRANCH: ${{ github.ref_name }} - name: Build site run: yarn run site:build - name: 'Deploy Site'