Skip to content

Commit

Permalink
Update github workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
ylabonte committed Mar 7, 2024
1 parent 106c7fc commit d098927
Show file tree
Hide file tree
Showing 36 changed files with 2,459 additions and 6,133 deletions.
13 changes: 8 additions & 5 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
# 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://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "daily"
assignees:
- "ylabonte"
groups:
dev-dependencies:
dependency-type: "development"
production:
dependency-type: "production"
versioning-strategy: "increase"
34 changes: 34 additions & 0 deletions .github/workflows/automerge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: "Auto-Merge Dependabot PRs"

on:
workflow_run:
workflows:
- "CI Workflow"
types:
- completed

permissions:
contents: write
pull-requests: write

jobs:
automerge:
name: "Auto-merge Dependabot PR"
runs-on: ubuntu-latest
if: github.actor == 'dependabot[bot]'
steps:
- name: "Fetch Dependabot metadata"
id: metadata
uses: dependabot/fetch-metadata@v1
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: "Approve the PR"
run: gh pr review --approve "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: "Auto-merge the PRs"
run: gh pr merge --auto --merge "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
47 changes: 32 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,47 @@
name: "CI Workflow"

permissions:
pull-requests: write
issues: write
contents: write

on:
push:
branches: [ "master", "develop", "feature/*" ]
branches:
- "master"
- "develop"
- "feature/*"
pull_request:
branches: [ "master", "develop", "feature/*" ]
branches:
- "master"
- "develop"
- "feature/*"

jobs:
build:
runs-on: ${{ matrix.os }}
name: "Build and lint"
runs-on: ubuntu-latest

strategy:
matrix:
os: [ubuntu-latest, windows-latest]
node-version: [16, 18]
node-version:
- 16
- 18
- 20

steps:
- run: git config --global core.autocrlf false
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
- name: "Ensure line endings"
run: git config --global core.autocrlf false
- name: "Checkout repository"
uses: actions/checkout@v4
- name: "Set up Node.js v${{ matrix.node-version }}"
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm run build
- run: npm run lint
- run: npm run test
env:
CI: true
cache: "yarn"
- name: "Install dependencies"
run: yarn
- name: "Build"
run: yarn run build
- name: "Run linter"
run: yarn run lint
40 changes: 0 additions & 40 deletions .github/workflows/codeql-analysis.yml

This file was deleted.

44 changes: 21 additions & 23 deletions .github/workflows/release-github.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,29 @@ name: "Github Package Release"

on:
workflow_run:
workflows: [ "NPM Package Release" ]
types: [ "completed" ]
workflows:
- "NPM Package Release"
types:
- completed

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: actions/checkout@v3

- name: "Setup node environment"
uses: actions/setup-node@v3
with:
node-version: '18'
registry-url: 'https://npm.pkg.github.com'

# Rewrite package.json to have the package name scoped for publishing to the github repo.
- name: "Rewrite package.json for github publishing"
run: |
sed -i.orig "s/\(\"name\": \"\)\(procon-ip\"\)/\1@ylabonte\/\2/" package.json

- name: "Setup dependencies"
run: npm ci

- name: "Build and publish project on github.com"
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: "Checkout"
uses: actions/checkout@v4
- name: "Setup node environment"
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: 'https://npm.pkg.github.com'
- name: "Rewrite package.json for github publishing"
run: |
sed -i.orig "s/\(\"name\": \"\)\(procon-ip\"\)/\1@ylabonte\/\2/" package.json
- name: "Setup dependencies"
run: yarn
- name: "Publish project on github.com"
run: yarn publish
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32 changes: 15 additions & 17 deletions .github/workflows/release-npmjs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,24 @@ name: "NPM Package Release"

on:
release:
types: [ "created" ]
types:
- created

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: "Checkout"
uses: actions/checkout@v3

- name: "Setup node environment"
uses: actions/setup-node@v3
with:
node-version: '18'
registry-url: 'https://registry.npmjs.org'

- name: "Setup dependencies"
run: npm ci

- name: "Build and publish project on npmjs.com"
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: "Checkout"
uses: actions/checkout@v4
- name: "Setup node environment"
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: 'https://registry.npmjs.org'
- name: "Setup dependencies"
run: yarn
- name: "Publish project on npmjs.com"
run: yarn publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
Loading

0 comments on commit d098927

Please sign in to comment.