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 #9 from salimkayabasi/better-gha
Better gha automation
- Loading branch information
Showing
2 changed files
with
70 additions
and
23 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,67 @@ | ||
name: Build & Test & Deploy | ||
name: CI | ||
|
||
on: push | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
check_deploy: | ||
cancel: | ||
runs-on: ubuntu-latest | ||
name: Cancel previous jobs | ||
steps: | ||
- name: Cancel Previous Runs | ||
uses: styfle/cancel-workflow-action@0.7.0 | ||
with: | ||
access_token: ${{ github.token }} | ||
lint: | ||
name: Lint | ||
runs-on: ubuntu-latest | ||
needs: | ||
- cancel | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2.3.4 | ||
- name: Setup Node version | ||
uses: actions/setup-node@v2.1.4 | ||
- name: Install Packages | ||
run: npm ci | ||
- name: Lint Files | ||
run: npm run lint | ||
test: | ||
name: Test | ||
timeout-minutes: 5 | ||
runs-on: ${{ matrix.os }} | ||
needs: | ||
- lint | ||
strategy: | ||
matrix: | ||
os: | ||
- ubuntu-latest | ||
- macos-latest | ||
- windows-latest | ||
node_version: | ||
- 10 | ||
- 12 | ||
- 14 | ||
architecture: | ||
- x64 | ||
# an extra windows-x86 run: | ||
include: | ||
- os: windows-2016 | ||
node_version: 12 | ||
architecture: x86 | ||
node: | ||
- '15' | ||
- '14' | ||
- '12' | ||
- '10' | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
# Prepare | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Setup Node version | ||
uses: actions/setup-node@v2.1.4 | ||
with: | ||
node-version: ${{ matrix.node_version }} | ||
architecture: ${{ matrix.architecture }} | ||
# Fetch dependencies | ||
node-version: ${{ matrix.node }} | ||
- name: Node version | ||
run: node -v && npm -v | ||
- name: Fetch dependencies | ||
run: npm ci | ||
# Linters | ||
- name: Linting | ||
run: npm run lint | ||
# Testing | ||
if: ${{ !startswith(matrix.node, '15') }} | ||
- name: Fetch dependencies | ||
run: npm ci --legacy-peer-deps | ||
if: ${{ startswith(matrix.node, '15') }} | ||
- name: Testing | ||
run: npm run test |
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,23 @@ | ||
name: Release | ||
on: | ||
push: | ||
branches: | ||
- main | ||
jobs: | ||
release: | ||
name: Release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2.3.4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Setup Node version | ||
uses: actions/setup-node@v2.1.4 | ||
- name: Install dependencies | ||
run: npm ci | ||
- name: Release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
run: npx semantic-release |