Skip to content

Commit

Permalink
fix(ci): cicd workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
wesleytodd committed Oct 16, 2023
1 parent ce928ab commit 47dd787
Show file tree
Hide file tree
Showing 8 changed files with 5,949 additions and 20 deletions.
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: 2
updates:
- package-ecosystem: npm
directory: /
schedule:
interval: weekly
groups:
production-dependencies:
dependency-type: "production"
development-dependencies:
dependency-type: "development"
42 changes: 42 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Release
on:
push:
branches:
- main
permissions:
contents: write
pull-requests: write
actions: write
jobs:
test:
uses: wesleytodd/opta/.github/workflows/test-workflow.yml@main
release:
name: Release
runs-on: ubuntu-latest
needs: [test]
outputs:
releasePlease: ${{ toJSON(steps.releasePlease.outputs) }}
steps:
- uses: actions/checkout@v4
- uses: google-github-actions/release-please-action@v3
name: Release Please
if: github.ref_name == 'main'
id: releasePlease
with:
release-type: node
token: ${{ secrets.GITHUB_TOKEN }}
publish:
name: Publish
runs-on: ubuntu-latest
needs: [release]
steps:
- uses: actions/checkout@v4
- name: Use Node.js 20.x
uses: actions/setup-node@v3
with:
node-version: 20.x
cache: 'npm'
- run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> .npmrc
- name: Publish
if: github.ref_name == 'main' && !fromJson(needs.release.outputs.releasePlease).pr
run: npm publish --dry-run
46 changes: 46 additions & 0 deletions .github/workflows/test-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Test
on:
workflow_call:
jobs:
setup:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js 20.x
uses: actions/setup-node@v3
with:
node-version: 20.x
cache: 'npm'
- name: Install
run: npm ci && npm audit
lint:
runs-on: ubuntu-latest
needs: setup
steps:
- uses: actions/checkout@v4
- name: Use Node.js 20.x
uses: actions/setup-node@v3
with:
node-version: 20.x
cache: 'npm'
- name: Install
run: npm install
- name: Lint
run: npm run lint
test:
runs-on: ubuntu-latest
needs: setup
strategy:
matrix:
node-version: [12.x, 14.x, 16.x, 18.x, 20.x]
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'
- name: Install
run: npm install --package-lock=false
- name: Test
run: npm test
17 changes: 2 additions & 15 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,7 @@
name: Test
on:
pull_request:
push:
branches:
- master
types: [opened, synchronize, reopened, ready_for_review]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x, 14.x, 16.x, 17.x]
steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: npm install and test
run: npm it
uses: wesleytodd/opta/.github/workflows/test-workflow.yml@main
5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# default
package-lock.json

# Logs
logs
*.log
Expand Down Expand Up @@ -121,7 +118,7 @@ dist
.LSOverride

# Icon must end with two \r
Icon
Icon

# Thumbnails
._*
Expand Down
1 change: 0 additions & 1 deletion .npmrc

This file was deleted.

Loading

0 comments on commit 47dd787

Please sign in to comment.