Skip to content

Commit

Permalink
Merge pull request #89 from technote-space/chore/chore-sync-workflows
Browse files Browse the repository at this point in the history
chore: sync workflows
  • Loading branch information
technote-space authored Oct 9, 2020
2 parents fde5e8f + e92479b commit 0fc28ad
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 39 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/add-release-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
EXCLUDE_MESSAGES: ${{ env.EXCLUDE_MESSAGES }}
if: "! startsWith(github.head_ref, 'release/v')"
- name: Get version
run: echo "::set-env name=NEXT_VERSION::${HEAD_REF#release/}"
run: echo "NEXT_VERSION=${HEAD_REF#release/}" >> $GITHUB_ENV
env:
HEAD_REF: ${{ github.head_ref }}
if: startsWith(github.head_ref, 'release/v')
Expand Down
43 changes: 16 additions & 27 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,18 @@ jobs:
with:
EXCLUDE_MERGED: 'true'
- name: Set running flag
run: echo "::set-env name=RUNNING::1"
run: echo "RUNNING=1" >> $GITHUB_ENV
- uses: actions/checkout@v2
- uses: technote-space/get-git-comment-action@v1
- uses: technote-space/get-diff-action@v3
- uses: technote-space/get-diff-action@v4
with:
PREFIX_FILTER: |
src/
__tests__/
SUFFIX_FILTER: |
.js
.ts
PATTERNS: +(src|__tests__)/**/*.+(js|ts)
FILES: |
yarn.lock
.eslintrc
if: "! contains(env.COMMIT_MESSAGE, '[skip ci]') && ! contains(env.COMMIT_MESSAGE, '[ci skip]')"
- name: Set running flag
run: echo "::set-env name=RUNNING::"
run: echo "RUNNING=" >> $GITHUB_ENV
if: "! env.GIT_DIFF"

- name: Get Yarn Cache Directory
Expand Down Expand Up @@ -65,35 +60,29 @@ jobs:
node: ['12', '14']
steps:
- name: Set running flag
run: echo "::set-env name=RUNNING::1"
run: echo "RUNNING=1" >> $GITHUB_ENV
- uses: actions/checkout@v2
- uses: technote-space/get-git-comment-action@v1
- uses: technote-space/get-diff-action@v3
- uses: technote-space/get-diff-action@v4
with:
PREFIX_FILTER: |
src/
__tests__/
SUFFIX_FILTER: |
.js
.ts
.snap
PATTERNS: +(src|__tests__)/**/*.+(js|ts|snap)
FILES: |
yarn.lock
jest.config.js
if: "! contains(env.COMMIT_MESSAGE, '[skip ci]') && ! contains(env.COMMIT_MESSAGE, '[ci skip]')"
- name: Set running flag
run: echo "::set-env name=RUNNING::"
run: echo "RUNNING=" >> $GITHUB_ENV
if: "! env.GIT_DIFF"
- name: Set running flag
if: "matrix.node == '12' && ! startsWith(github.ref, 'refs/tags/') && github.event.base_ref == format('refs/heads/{0}', github.event.repository.default_branch)"
run: echo "::set-env name=RUNNING::1"
run: echo "RUNNING=1" >> $GITHUB_ENV
- name: Set running flag
if: matrix.node == '12' && startsWith(github.ref, 'refs/tags/v')
run: echo "::set-env name=RUNNING::1"
run: echo "RUNNING=1" >> $GITHUB_ENV
- name: Set running flag
run: |
if [[ ! -f package.json ]] || ! < package.json jq -r '.scripts | keys[]' | grep -qe '^cover$'; then
echo "::set-env name=RUNNING::"
echo "RUNNING=" >> $GITHUB_ENV
fi
- name: Setup node
Expand Down Expand Up @@ -140,25 +129,25 @@ jobs:
target: ['npm', 'gpr']
steps:
- name: Set running flag
run: echo "::set-env name=RUNNING::1"
run: echo "RUNNING=1" >> $GITHUB_ENV
- name: Set running flag
run: |
if [ -z "$NPM_AUTH_TOKEN" ]; then
echo "::set-env name=RUNNING::"
echo "RUNNING=" >> $GITHUB_ENV
fi
env:
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
- uses: actions/checkout@v2
if: env.RUNNING
- name: Set running flag
run: npx can-npm-publish || echo "::set-env name=RUNNING::"
run: npx can-npm-publish || echo "RUNNING=" >> $GITHUB_ENV
if: env.RUNNING && matrix.target == 'npm'
- name: Set running flag
run: |
LATEST=`npm view . version` 2> /dev/null || :
CURRENT=`cat package.json | jq -r .version`
if [ "$LATEST" = "$CURRENT" ]; then
echo "::set-env name=RUNNING::"
echo "RUNNING=" >> $GITHUB_ENV
fi
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down Expand Up @@ -220,7 +209,7 @@ jobs:
timeout-minutes: 5
steps:
- name: Get version
run: echo "::set-env name=TAG_NAME::${HEAD_REF#refs/tags/}"
run: echo "TAG_NAME=${HEAD_REF#refs/tags/}" >> $GITHUB_ENV
env:
HEAD_REF: ${{ github.ref }}
- name: Create Release
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/pr-updated.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@ jobs:
with:
CONFIG_FILENAME: workflow-settings.json
- name: Set running flag
run: echo "::set-env name=RUNNING::1"
run: echo "RUNNING=1" >> $GITHUB_ENV
- uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
- name: Set running flag
run: |
if [[ ! -f package.json ]] || [[ $(< package.json jq -r '.version == null') == 'true' ]]; then
echo "::set-env name=RUNNING::"
echo "RUNNING=" >> $GITHUB_ENV
fi
- name: Sort
Expand All @@ -72,7 +72,7 @@ jobs:
EXCLUDE_MESSAGES: ${{ env.EXCLUDE_MESSAGES }}
if: "env.RUNNING && ! startsWith(github.head_ref, 'release/v')"
- name: Get version
run: echo "::set-env name=NEXT_VERSION::${HEAD_REF#release/}"
run: echo "NEXT_VERSION=${HEAD_REF#release/}" >> $GITHUB_ENV
env:
HEAD_REF: ${{ github.head_ref }}
if: env.RUNNING && startsWith(github.head_ref, 'release/v')
Expand All @@ -91,11 +91,11 @@ jobs:
if: "github.event.pull_request.head.user.id == github.event.pull_request.base.user.id && startsWith(github.head_ref, 'release/')"
steps:
- name: Set running flag
run: echo "::set-env name=RUNNING::1"
run: echo "RUNNING=1" >> $GITHUB_ENV
- name: Set running flag
run: |
if [ -z "$NPM_AUTH_TOKEN" ]; then
echo "::set-env name=RUNNING::"
echo "RUNNING=" >> $GITHUB_ENV
fi
env:
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/update-dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ jobs:
timeout-minutes: 10
steps:
- name: Set running flag
run: echo "::set-env name=RUNNING1::"
run: echo "RUNNING1=" >> $GITHUB_ENV
- name: Set running flag
run: echo "::set-env name=RUNNING1::1"
run: echo "RUNNING1=1" >> $GITHUB_ENV
if: github.event.pull_request.head.user.id == github.event.pull_request.base.user.id
- uses: technote-space/load-config-action@v1
if: env.RUNNING1
Expand Down Expand Up @@ -46,16 +46,16 @@ jobs:
AUTO_MERGE_THRESHOLD_DAYS: 14

- name: Set running flag
run: echo "::set-env name=RUNNING2::"
run: echo "RUNNING2=" >> $GITHUB_ENV
- name: Set running flag
run: echo "::set-env name=RUNNING2::1"
run: echo "RUNNING2=1" >> $GITHUB_ENV
if: env.RUNNING1 && steps.update_deps.outputs.result != 'succeeded' && github.event_name == 'pull_request' && github.event.action != 'closed' && startsWith(github.head_ref, 'release/')
- uses: actions/checkout@v2
if: env.RUNNING2
- name: Set running flag
run: |
if [[ ! -f package.json ]] || [[ $(< package.json jq -r '.version == null') == 'true' ]]; then
echo "::set-env name=RUNNING2::"
echo "RUNNING2=" >> $GITHUB_ENV
fi
- name: Sort
run: npx sort-package-json
Expand All @@ -66,7 +66,7 @@ jobs:
EXCLUDE_MESSAGES: ${{ env.EXCLUDE_MESSAGES }}
if: "env.RUNNING2 && ! startsWith(github.head_ref, 'release/v')"
- name: Get version
run: echo "::set-env name=NEXT_VERSION::${HEAD_REF#release/}"
run: echo "NEXT_VERSION=${HEAD_REF#release/}" >> $GITHUB_ENV
env:
HEAD_REF: ${{ github.head_ref }}
if: env.RUNNING2 && startsWith(github.head_ref, 'release/v')
Expand Down

0 comments on commit 0fc28ad

Please sign in to comment.