Skip to content

Commit

Permalink
build: better github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Kikobeats committed Feb 6, 2023
1 parent 39d66ea commit 54a2b31
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 10 deletions.
8 changes: 4 additions & 4 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
version: 2
updates:
- package-ecosystem: npm
directory: "/"
directory: '/'
schedule:
interval: daily
- package-ecosystem: "github-actions"
directory: "/"
- package-ecosystem: 'github-actions'
directory: '/'
schedule:
# Check for updates to GitHub Actions every weekday
interval: "daily"
interval: 'daily'
63 changes: 63 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: main

on:
push:
branches:
- master

jobs:
contributors:
if: "${{ github.event.head_commit.message != 'build: contributors' }}"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: lts/*
- name: Setup PNPM
uses: pnpm/action-setup@v2
with:
version: latest
run_install: true
- name: Contributors
run: |
git config --global user.email ${{ secrets.GIT_EMAIL }}
git config --global user.name ${{ secrets.GIT_USERNAME }}
npm run contributors
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GH_TOKEN }}
branch: ${{ github.head_ref }}

test:
if: ${{ !startsWith(github.event.head_commit.message, 'chore(release):') && !startsWith(github.event.head_commit.message, 'docs:') && !startsWith(github.event.head_commit.message, 'ci:') }}
needs: [contributors]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: lts/*
- name: Setup PNPM
uses: pnpm/action-setup@v2
with:
version: latest
run_install: true
- name: Test
run: npm test
- name: Report
run: mkdir -p coverage && npx c8 report --reporter=text-lcov > coverage/lcov.info
- name: Coverage
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
name: pull_request

on:
push:
branches:
Expand All @@ -6,15 +8,15 @@ on:
branches:
- master

env:
CI: true

jobs:
test:
if: github.ref != 'refs/heads/master'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Node.js
uses: actions/setup-node@v3
with:
Expand All @@ -26,9 +28,9 @@ jobs:
run_install: true
- name: Test
run: npm test
- name: Report
run: mkdir -p coverage && npx c8 report --reporter=text-lcov > coverage/lcov.info
- name: Coverage
run: npm run coverage
- name: Upload
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
"dev": "concurrently \"gulp\" \"npm run dev:server\"",
"dev:server": "browser-sync start --server --files \"index.html, README.md, static/**/*.(css|js)\"",
"lint": "standard",
"prerelease": "pnpm run update:check && pnpm run contributors",
"prerelease": "pnpm run update:check",
"pretest": "pnpm run lint",
"release": "lerna publish --yes --sort --conventional-commits -m \"chore(release): %s\" --create-release github",
"test": "c8 lerna exec pnpm run test",
Expand Down

0 comments on commit 54a2b31

Please sign in to comment.