Skip to content

Commit

Permalink
ci(actions): separate actions
Browse files Browse the repository at this point in the history
PRs all include the skipped release step, while linting on push to master is pointless. Separating
the tasks.
  • Loading branch information
Astrak committed Jun 15, 2020
1 parent a4735fe commit 8e051c5
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 19 deletions.
22 changes: 3 additions & 19 deletions .github/workflows/lint-release.yml → .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: lint and release
name: lint

on: [push, pull_request]
on: [pull_request]

jobs:
# Ensure that the codebase is linted: run eslint.
Expand All @@ -16,7 +16,7 @@ jobs:
- run: yarn lint
# Ensure that the commit messages in a PR are linted:
# - we want to run `<messages> | npx commitlint` (last line)
# - we get the messages via `git log <target_branch>.. --pretty=format:"%s"`
# - we debug the messages via `git log <target_branch>.. --pretty=format:"%s"`
pr-commitlint:
runs-on: ubuntu-latest
if: github.ref != 'refs/heads/master'
Expand All @@ -33,19 +33,3 @@ jobs:
run: git log origin/${{ github.event.pull_request.base.ref }}.. --pretty=format:"%s"
- name: Vet PR commit messages
run: git log origin/${{ github.event.pull_request.base.ref }}.. --pretty=format:"%s" | npx commitlint
release:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
needs: [lint] # Do not release if the linter fails. pr-commitlint is missing because it doesn't run on master.
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: "12.13.0"
- run: npm i -g yarn
- run: yarn
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx semantic-release
24 changes: 24 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: release

on:
push:
branches:
- master

jobs:
release:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
needs: [lint] # Do not release if the linter fails. pr-commitlint is missing because it doesn't run on master.
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: "12.13.0"
- run: npm i -g yarn
- run: yarn
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx semantic-release

0 comments on commit 8e051c5

Please sign in to comment.