-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #64 from technote-space/chore/chore-sync-workflows
chore: sync workflows
- Loading branch information
Showing
13 changed files
with
263 additions
and
180 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
on: | ||
pull_request: | ||
branches: | ||
- master | ||
types: [closed] | ||
|
||
name: Add version tag | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'release/v') | ||
steps: | ||
- name: Get version | ||
run: echo "::set-env name=TAG_NAME::${HEAD_REF#release/}" | ||
env: | ||
HEAD_REF: ${{ github.event.pull_request.head.ref }} | ||
- uses: actions/github-script@0.4.0 | ||
with: | ||
github-token: ${{ secrets.ACCESS_TOKEN }} | ||
script: | | ||
github.git.createRef({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
ref: `refs/tags/${process.env.TAG_NAME}`, | ||
sha: context.sha | ||
}) |
4 changes: 2 additions & 2 deletions
4
.github/workflows/check_version.yml → .github/workflows/check-version.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,119 +1,244 @@ | ||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- master | ||
tags: | ||
- "!*" | ||
on: push | ||
|
||
name: CI | ||
|
||
jobs: | ||
eslint: | ||
name: ESLint | ||
runs-on: ubuntu-latest | ||
env: | ||
LINT: 1 | ||
steps: | ||
- name: Set running flag | ||
run: echo "::set-env name=RUNNING::1" | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 3 | ||
- uses: technote-space/get-git-comment-action@v1 | ||
- uses: technote-space/get-diff-action@v1 | ||
with: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
PREFIX_FILTER: | | ||
src/ | ||
__tests__/ | ||
SUFFIX_FILTER: .ts | ||
SUFFIX_FILTER: | | ||
.js | ||
.ts | ||
FILES: .eslintrc | ||
if: "! contains(env.COMMIT_MESSAGE, '[skip ci]') && ! contains(env.COMMIT_MESSAGE, '[ci skip]')" | ||
- name: Set running flag | ||
run: echo "::set-env name=RUNNING::" | ||
if: "! env.GIT_DIFF" | ||
|
||
- name: Get Yarn Cache Directory | ||
id: yarn-cache | ||
run: echo "::set-output name=dir::$(yarn cache dir)" | ||
if: env.GIT_DIFF | ||
if: env.RUNNING | ||
- name: Cache node dependencies | ||
uses: actions/cache@v1 | ||
with: | ||
path: ${{ steps.yarn-cache.outputs.dir }} | ||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-yarn- | ||
if: env.GIT_DIFF | ||
if: env.RUNNING | ||
- name: Install Package dependencies | ||
run: yarn install | ||
if: env.GIT_DIFF | ||
if: env.RUNNING | ||
- name: Check code style | ||
run: yarn eslint ${{ env.GIT_DIFF }} | ||
if: env.GIT_DIFF | ||
- uses: 8398a7/action-slack@v1 | ||
if: env.RUNNING | ||
- uses: 8398a7/action-slack@v2 | ||
with: | ||
type: failure | ||
status: failure | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | ||
if: failure() | ||
|
||
jest: | ||
name: Jest | ||
cover: | ||
name: Coverage | ||
needs: eslint | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node: ['10', '11', '12'] | ||
node: ['11', '12'] | ||
steps: | ||
- name: Set running flag | ||
run: echo "::set-env name=RUNNING::1" | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 3 | ||
- uses: technote-space/get-git-comment-action@v1 | ||
- uses: technote-space/get-diff-action@v1 | ||
with: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
PREFIX_FILTER: | | ||
src/ | ||
__tests__/ | ||
SUFFIX_FILTER: .ts | ||
SUFFIX_FILTER: | | ||
.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::" | ||
if: "! env.GIT_DIFF" | ||
- name: Set running flag | ||
if: matrix.node == '12' && startsWith(github.ref, 'refs/tags/') | ||
run: echo "::set-env name=RUNNING::1" | ||
- name: Set running flag | ||
run: | | ||
if [[ ! -f package.json ]] || ! < package.json jq -r '.scripts | keys[]' | grep -qe '^cover$'; then | ||
echo "::set-env name=RUNNING::" | ||
fi | ||
- name: Setup node | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: ${{ matrix.node }} | ||
if: env.GIT_DIFF || github.event_name == 'push' | ||
if: env.RUNNING | ||
- name: Get Yarn Cache Directory | ||
id: yarn-cache | ||
run: echo "::set-output name=dir::$(yarn cache dir)" | ||
if: env.GIT_DIFF || github.event_name == 'push' | ||
if: env.RUNNING | ||
- name: Cache node dependencies | ||
uses: actions/cache@v1 | ||
with: | ||
path: ${{ steps.yarn-cache.outputs.dir }} | ||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-yarn- | ||
if: env.GIT_DIFF || github.event_name == 'push' | ||
if: env.RUNNING | ||
- name: Install Package dependencies | ||
run: yarn install | ||
if: env.GIT_DIFF || github.event_name == 'push' | ||
if: env.RUNNING | ||
- name: Run tests | ||
run: yarn cover | ||
if: env.GIT_DIFF || github.event_name == 'push' | ||
if: env.RUNNING | ||
- name: Codecov | ||
run: curl -s https://codecov.io/bash | bash -s -- -t $CODECOV_TOKEN -f $COVERAGE_FILE | ||
run: | | ||
if [ -n "$CODECOV_TOKEN" ]; then | ||
curl -s https://codecov.io/bash | bash -s -- -t $CODECOV_TOKEN -f $COVERAGE_FILE | ||
fi | ||
env: | ||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | ||
COVERAGE_FILE: ./coverage/lcov.info | ||
if: matrix.node == '12' && (env.GIT_DIFF || github.event_name == 'push') | ||
- uses: 8398a7/action-slack@v1 | ||
if: env.RUNNING && matrix.node == '12' | ||
- uses: 8398a7/action-slack@v2 | ||
with: | ||
type: failure | ||
status: failure | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | ||
if: failure() | ||
|
||
slack: | ||
name: Slack | ||
needs: jest | ||
package: | ||
name: Publish Package | ||
needs: cover | ||
runs-on: ubuntu-latest | ||
if: startsWith(github.ref, 'refs/tags/v') | ||
strategy: | ||
matrix: | ||
target: ['npm', 'gpr'] | ||
steps: | ||
- uses: 8398a7/action-slack@v1 | ||
- name: Set running flag | ||
run: echo "::set-env name=RUNNING::1" | ||
- name: Set running flag | ||
run: | | ||
if [ -z "$NPM_AUTH_TOKEN" ]; then | ||
echo "::set-env name=RUNNING::" | ||
fi | ||
env: | ||
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} | ||
|
||
- uses: actions/checkout@v2 | ||
if: env.RUNNING | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: 12 | ||
registry-url: https://registry.npmjs.org/ | ||
if: env.RUNNING && matrix.target == 'npm' | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: 12 | ||
registry-url: https://npm.pkg.github.com | ||
if: env.RUNNING && matrix.target == 'gpr' | ||
- name: Get Yarn Cache Directory | ||
id: yarn-cache | ||
run: echo "::set-output name=dir::$(yarn cache dir)" | ||
if: env.RUNNING | ||
- name: Cache node dependencies | ||
uses: actions/cache@v1 | ||
with: | ||
path: ${{ steps.yarn-cache.outputs.dir }} | ||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-yarn- | ||
if: env.RUNNING | ||
- name: Check package version | ||
uses: technote-space/package-version-check-action@v1 | ||
with: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
COMMIT_DISABLED: 1 | ||
if: env.RUNNING | ||
- name: Install Package dependencies | ||
run: yarn install | ||
if: env.RUNNING | ||
- name: Build | ||
run: yarn build | ||
if: env.RUNNING | ||
- name: Publish | ||
run: | | ||
npm config set //registry.npmjs.org/:_authToken=$NPM_AUTH_TOKEN | ||
npm publish | ||
env: | ||
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} | ||
if: env.RUNNING && matrix.target == 'npm' | ||
- name: Publish | ||
run: | | ||
npm publish | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
if: env.RUNNING && matrix.target == 'gpr' | ||
- uses: 8398a7/action-slack@v2 | ||
with: | ||
status: failure | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | ||
if: failure() | ||
|
||
publishRelease: | ||
name: Create Release | ||
needs: [package] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Get version | ||
run: echo "::set-env name=TAG_NAME::${HEAD_REF#refs/tags/}" | ||
env: | ||
HEAD_REF: ${{ github.ref }} | ||
- name: Create Release | ||
id: drafter | ||
uses: technote-space/release-drafter@v6 | ||
with: | ||
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} | ||
DRAFT: false | ||
NAME: ${{ env.TAG_NAME }} | ||
TAG: ${{ env.TAG_NAME }} | ||
- uses: 8398a7/action-slack@v2 | ||
with: | ||
status: ${{ job.status }} | ||
text: ${{ format('<{0}>', steps.drafter.outputs.html_url) }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | ||
if: always() && steps.drafter.outputs.html_url | ||
- uses: 8398a7/action-slack@v2 | ||
with: | ||
type: success | ||
status: ${{ job.status }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | ||
if: always() && ! steps.drafter.outputs.html_url |
This file was deleted.
Oops, something went wrong.
2 changes: 2 additions & 0 deletions
2
.github/workflows/issue_opened.yml → .github/workflows/issue-opened.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
on: | ||
issues: | ||
types: [opened] | ||
|
||
name: Issue opened | ||
|
||
jobs: | ||
assign: | ||
name: Assign issues to project | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.