Skip to content

Commit

Permalink
chore: github actions prepping for auto releases
Browse files Browse the repository at this point in the history
  • Loading branch information
nmccready committed Aug 24, 2024
1 parent 8b02176 commit af33f70
Show file tree
Hide file tree
Showing 5 changed files with 141 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "npm"
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
40 changes: 40 additions & 0 deletions .github/workflows/commitlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: commitlint

on:
workflow_call:
push:
pull_request:
branches: ["master"]

jobs:
commitlint:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install required dependencies
run: |
sudo apt update
sudo apt install -y sudo
sudo apt install -y git curl
- uses: actions/setup-node@v3
with:
node-version: 20
- name: node setup
run: npm i
- name: Print versions
run: |
git --version
node --version
npm --version
npx commitlint --version
- name: Validate current commit (last commit) with commitlint
if: github.event_name == 'push'
run: npx commitlint --last --verbose

- name: Validate PR commits with commitlint
if: github.event_name == 'pull_request'
run: npx commitlint --from ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} --to ${{ github.event.pull_request.head.sha }} --verbose
28 changes: 28 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# TODO: ENABLE / UNCOMMENT WHEN NPM_TOKEN IS SET in secrets REPO
# name: publish

# on:
# push:
# tags:
# - "v*"

# jobs:
# tests:
# uses: ./.github/workflows/tests.yml
# publish-npm:
# needs: [tests]
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - name: Use Node.js ${{ matrix.node-version }}
# uses: actions/setup-node@v3
# with:
# node-version: '20.x'
# registry-url: 'https://registry.npmjs.org'
# - name: Publish to npm
# run: |
# npm install
# npm publish --access public
# env:
# NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
# #kick
38 changes: 38 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# TODO: ENABLE / UNCOMMENT WHEN NPM_TOKEN IS SET in secrets REPO
# name: release

# on:
# push:
# branches: ["master"]
# tags-ignore: ['**']

# jobs:
# tests:
# uses: ./.github/workflows/tests.yml
# tag-release:
# runs-on: ubuntu-latest
# needs: [tests]
# steps:
# - uses: actions/checkout@v4
# with: # important, must be defined on checkout to kick publish (defining in setup/node doesn't work)
# token: ${{ secrets.GH_TOKEN }}
# - name: Use Node.js ${{ matrix.node-version }}
# uses: actions/setup-node@v3
# with:
# node-version: '20.x'
# # cache: "npm" # needs lockfile if enabled

# - name: tag release
# run: |
# # ignore if commit message is chore(release): ...
# if [[ $(git log -1 --pretty=%B) =~ ^chore\(release\):.* ]]; then
# echo "Commit message starts with 'chore(release):', skipping release"
# exit 0
# fi
# git config --local user.email "[email protected]"
# git config --local user.name "creadbot_github"
# set -v
# npm install
# npx commit-and-tag-version
# git push
# git push --tags
24 changes: 24 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: tests

on:
workflow_call:
pull_request:
branches: ["master"]

jobs:
test:
strategy:
matrix:
node-version: ['18.x', '20.x', '22.x']
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
# cache: "npm" # needs lockfile if enabled

- run: npm install
- run: npm run lint
- run: npm test

0 comments on commit af33f70

Please sign in to comment.