Skip to content

chore: sync workflows #155

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .github/workflows/add-test-tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
on:
pull_request:
types: [synchronize]

name: Add test tag

jobs:
tag:
name: Add test tag
runs-on: ubuntu-latest
if: startsWith(github.event.pull_request.head.ref, 'release/')
steps:
- uses: actions/checkout@v2
- uses: technote-space/get-git-comment-action@v1
- name: Get version
run: echo "::set-env name=TAG_NAME::${HEAD_REF#release/}"
env:
HEAD_REF: ${{ github.event.pull_request.head.ref }}
if: contains(env.COMMIT_MESSAGE, 'trigger workflow')
- 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/test/${process.env.TAG_NAME}`,
sha: context.sha
})
if: contains(env.COMMIT_MESSAGE, 'trigger workflow')
5 changes: 3 additions & 2 deletions .github/workflows/add-version-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ on:
name: Add version tag

jobs:
release:
tag:
name: Add version tag
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'release/v')
if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'release/')
steps:
- name: Get version
run: echo "::set-env name=TAG_NAME::${HEAD_REF#release/}"
Expand Down
36 changes: 23 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -175,57 +175,67 @@ jobs:
matrix:
target: ['npm', 'gpr']
steps:
- 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: matrix.target == 'npm'
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: matrix.target == 'gpr'
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: |
if [ -n "$NPM_AUTH_TOKEN" ]; then
npm config set //registry.npmjs.org/:_authToken=$NPM_AUTH_TOKEN
npm publish
fi
npm config set //registry.npmjs.org/:_authToken=$NPM_AUTH_TOKEN
npm publish
env:
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
if: matrix.target == 'npm'
if: env.RUNNING && matrix.target == 'npm'
- name: Publish
run: |
if [ -n "$NPM_AUTH_TOKEN" ]; then
npm publish
fi
npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
if: matrix.target == 'gpr'
if: env.RUNNING && matrix.target == 'gpr'
- uses: 8398a7/action-slack@v2
with:
status: failure
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-updated.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
triage:
name: Pull Request Labeler
runs-on: ubuntu-latest
if: "! startsWith(github.event.pull_request.head.ref, 'release/v')"
if: "! startsWith(github.event.pull_request.head.ref, 'release/')"
steps:
- name: Pull Request Labeler
uses: actions/labeler@v2
Expand Down