Skip to content

Commit

Permalink
ci: refactor workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
denysdovhan committed Dec 10, 2023
1 parent 3afe6a8 commit f13ab74
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 109 deletions.
1 change: 0 additions & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
github: denysdovhan
patreon: denysdovhan
custom: [buymeacoffee.com/denysdovhan]
78 changes: 78 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Main
on:
push:
pull_request:

permissions:
contents: write
pull-requests: write

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
validate:
name: Validate
runs-on: ubuntu-latest
steps:
- name: ⬇️ Checkout Repo
uses: actions/checkout@v4

- name: ⬢ Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '*'
cache: npm

- name: 📦 Install Packages
run: npm ci

- name: 🧪 Test
run: npm test

release:
name: Release
runs-on: ubuntu-latest
needs: [validate]
if: github.actor == 'denysdovhan' && github.event_name == 'push' && github.ref_name == 'main'
steps:
- name: ⬇️ Checkout Repo
uses: actions/checkout@v4

- name: ⬢ Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '*'
cache: npm

- name: 📦 Install Packages
run: npm ci

- name: 🏗 Build
run: npm run build

- name: 🚀 Release
run: npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

dependabot:
name: Dependabot Auto-merge
runs-on: ubuntu-latest
needs: [validate]
if: github.actor == 'dependabot[bot]' && github.event_name == 'pull_request'
steps:
- name: 💿 Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: ↔️ Enable Auto-merge for minor and patch Dependabot PRs
run: gh pr merge --auto --squash "$PR_URL"
if: steps.metadata.outputs.update-type == 'version-update:semver-minor' || steps.metadata.outputs.update-type == 'version-update:semver-patch'
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35 changes: 0 additions & 35 deletions .github/workflows/release.yml

This file was deleted.

40 changes: 0 additions & 40 deletions .github/workflows/stale.yml

This file was deleted.

33 changes: 0 additions & 33 deletions .github/workflows/validate.yml

This file was deleted.

0 comments on commit f13ab74

Please sign in to comment.