Skip to content

Commit

Permalink
fix(build-test-deploy.yml): debug pipeline statements always return true
Browse files Browse the repository at this point in the history
  • Loading branch information
Xunnamius committed Jan 2, 2021
1 parent 4fb641c commit b759c31
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
28 changes: 14 additions & 14 deletions .github/workflows/build-test-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,16 @@ jobs:
id: skip-ci
run: |
echo "::set-output name=should-skip::$CI_SKIP"
! [ -z "$DEBUG" ] && echo "set-output name=should-skip::$CI_SKIP"
! [ -z "$DEBUG" ] && echo "set-output name=should-skip::$CI_SKIP" || true
- name: Determine matrixes
if: steps.skip-ci.outputs.should-skip != 'true'
id: set-matrix
run: |
echo "::set-output name=node-matrix::{\"node\":[$NODE_TEST_VERSIONS, \"$NODE_CURRENT_VERSION\"]}"
echo "::set-output name=webpack-matrix::{\"webpack\":[$WEBPACK_TEST_VERSIONS]}"
! [ -z "$DEBUG" ] && echo "set-output name=node-matrix::{\"node\":[$NODE_TEST_VERSIONS, \"$NODE_CURRENT_VERSION\"]}"
! [ -z "$DEBUG" ] && echo "set-output name=webpack-matrix::{\"webpack\":[$WEBPACK_TEST_VERSIONS]}"
! [ -z "$DEBUG" ] && echo "set-output name=node-matrix::{\"node\":[$NODE_TEST_VERSIONS, \"$NODE_CURRENT_VERSION\"]}" || true
! [ -z "$DEBUG" ] && echo "set-output name=webpack-matrix::{\"webpack\":[$WEBPACK_TEST_VERSIONS]}" || true
- name: Gather branch metadata
if: steps.skip-ci.outputs.should-skip != 'true'
Expand All @@ -104,7 +104,7 @@ jobs:
id: branch
run: |
echo "::set-output name=current-branch::$BRANCH_NAME"
! [ -z "$DEBUG" ] && echo "set-output name=current-branch::$BRANCH_NAME"
! [ -z "$DEBUG" ] && echo "set-output name=current-branch::$BRANCH_NAME" || true
- name: Verify repository owner against whitelist
if: steps.skip-ci.outputs.should-skip != 'true'
Expand All @@ -115,7 +115,7 @@ jobs:
REPO='${{ github.repository }}'
node -e "process.exit('$WL'.toLowerCase().split(',').some(o => '$REPO'.toLowerCase().startsWith(o.trim() + '/')) ? 0 : 1)"
echo "::set-output name=is-whitelisted::$([ $? -eq 0 ] && echo 'true' || echo 'false')"
! [ -z "$DEBUG" ] && echo "set-output name=is-whitelisted::$([ $? -eq 0 ] && echo 'true' || echo 'false')"
! [ -z "$DEBUG" ] && echo "set-output name=is-whitelisted::$([ $? -eq 0 ] && echo 'true' || echo 'false')" || true
- name: Use node ${{ env.NODE_CURRENT_VERSION }}
if: steps.skip-ci.outputs.should-skip != 'true'
Expand All @@ -130,7 +130,7 @@ jobs:
set +e
NPMR=`npm run list-tasks`
! [ -z "$DEBUG" ] && echo 'NPMR=' $NPMR
! [ -z "$DEBUG" ] && echo 'NPMR=' $NPMR || true
if [ $? -ne 0 ]; then
echo '::error::`npm run list-tasks` failed'
Expand Down Expand Up @@ -162,14 +162,14 @@ jobs:
echo "::set-output name=has-integration-webpack::$HAS_WEBP"
echo "::set-output name=has-deploy::$HAS_DPLY"
! [ -z "$DEBUG" ] && echo "set-output name=has-release-config::$HAS_RCNF"
! [ -z "$DEBUG" ] && echo "set-output name=has-docs::$HAS_DOCS"
! [ -z "$DEBUG" ] && echo "set-output name=has-externals::$HAS_EXTS"
! [ -z "$DEBUG" ] && echo "set-output name=has-integration-node::$HAS_NODE"
! [ -z "$DEBUG" ] && echo "set-output name=has-integration-externals::$HAS_IEXT"
! [ -z "$DEBUG" ] && echo "set-output name=has-integration-browser::$HAS_BWSR"
! [ -z "$DEBUG" ] && echo "set-output name=has-integration-webpack::$HAS_WEBP"
! [ -z "$DEBUG" ] && echo "set-output name=has-deploy::$HAS_DPLY"
! [ -z "$DEBUG" ] && echo "set-output name=has-release-config::$HAS_RCNF" || true
! [ -z "$DEBUG" ] && echo "set-output name=has-docs::$HAS_DOCS" || true
! [ -z "$DEBUG" ] && echo "set-output name=has-externals::$HAS_EXTS" || true
! [ -z "$DEBUG" ] && echo "set-output name=has-integration-node::$HAS_NODE" || true
! [ -z "$DEBUG" ] && echo "set-output name=has-integration-externals::$HAS_IEXT" || true
! [ -z "$DEBUG" ] && echo "set-output name=has-integration-browser::$HAS_BWSR" || true
! [ -z "$DEBUG" ] && echo "set-output name=has-integration-webpack::$HAS_WEBP" || true
! [ -z "$DEBUG" ] && echo "set-output name=has-deploy::$HAS_DPLY" || true
if [ "$HAS_EXTS" != "$HAS_IEXT" ]; then
echo '::error::expected both 1) `build-externals` and 2) `test-integration-externals` scripts to be defined in package.json'
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
id: skip-ci
run: |
echo "::set-output name=should-skip::$CI_SKIP"
! [ -z "$DEBUG" ] && echo "set-output name=should-skip::$CI_SKIP"
! [ -z "$DEBUG" ] && echo "set-output name=should-skip::$CI_SKIP" || true
- name: Verify repository owner against whitelist
if: steps.skip-ci.outputs.should-skip != 'true'
Expand All @@ -62,7 +62,7 @@ jobs:
REPO='${{ github.repository }}'
node -e "process.exit('$WL'.toLowerCase().split(',').some(o => '$REPO'.toLowerCase().startsWith(o.trim() + '/')) ? 0 : 1)"
echo "::set-output name=is-whitelisted::$([ $? -eq 0 ] && echo 'true' || echo 'false')"
! [ -z "$DEBUG" ] && echo "set-output name=is-whitelisted::$([ $? -eq 0 ] && echo 'true' || echo 'false')"
! [ -z "$DEBUG" ] && echo "set-output name=is-whitelisted::$([ $? -eq 0 ] && echo 'true' || echo 'false')" || true
- name: Gather remaining metadata
if: steps.skip-ci.outputs.should-skip != 'true'
Expand All @@ -71,8 +71,8 @@ jobs:
set +e
[ -r release.config.js ] && echo "::set-output name=has-release-config::true"
[ -r package.json ] && echo "::set-output name=has-package-json::true"
! [ -z "$DEBUG" ] && [ -r release.config.js ] && echo "set-output name=has-release-config::true"
! [ -z "$DEBUG" ] && [ -r package.json ] && echo "set-output name=has-package-json::true"
! [ -z "$DEBUG" ] && [ -r release.config.js ] && echo "set-output name=has-release-config::true" || true
! [ -z "$DEBUG" ] && [ -r package.json ] && echo "set-output name=has-package-json::true" || true
cleanup-npm-dist-tags:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -113,13 +113,13 @@ jobs:
npm install micromatch
git remote prune origin
BRANCHES=`git for-each-ref --format='%(refname:lstrip=3)' refs/remotes/origin`
! [ -z "$DEBUG" ] && echo 'BRANCHES=' "$BRANCHES"
! [ -z "$DEBUG" ] && echo 'BRANCHES=' "$BRANCHES" || true
export BRANCHES
PKG_NAME=`node -e 'console.log(require("./package.json").name)'`
! [ -z "$DEBUG" ] && echo 'PKG_NAME=' "$PKG_NAME"
! [ -z "$DEBUG" ] && echo 'PKG_NAME=' "$PKG_NAME" || true
DIST_TAGS=`npm dist-tag list "$PKG_NAME"`
! [ -z "$DEBUG" ] && echo 'DIST_TAGS=' "$DIST_TAGS"
! [ -z "$DEBUG" ] && echo 'DIST_TAGS=' "$DIST_TAGS" || true
export DIST_TAGS
MATCHED_TAGS=$(node -e 'const match = require("micromatch"); const tags = process.env.DIST_TAGS.split("\n").map(t => t.split(":")[0]); const branches = match(process.env.BRANCHES.split("\n"), require("./release.config.js").branches.reduce((a,b) => [...a, b.name || b.toString()], [])); const ignoreTags = process.env.IGNORE_TAGS.split(", "); console.log(tags.reduce((a,t) => branches.some(b => ignoreTags.includes(t) || t == b || t == `release-${b}`) ? a : [...a, t], []).join(" ").trim())')
! [ -z "$DEBUG" ] && echo 'MATCHED_TAGS=' "$MATCHED_TAGS"
! [ -z "$DEBUG" ] && echo 'MATCHED_TAGS=' "$MATCHED_TAGS" || true
if ! [ -z "$MATCHED_TAGS" ]; then echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/.npmrc; echo $MATCHED_TAGS | xargs -n1 npm dist-tag rm "$PKG_NAME"; else echo "dist tags OK!"; fi

0 comments on commit b759c31

Please sign in to comment.