Skip to content

Commit

Permalink
Workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
SunDevil311 committed Jan 26, 2025
1 parent aea4e95 commit d858a0f
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 41 deletions.
32 changes: 11 additions & 21 deletions .github/workflows/webpack-gh.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,12 @@
name: Build/Test Webpack, Publish to GitHub Packages

on:
release:
types: [created]
workflow_dispatch:

jobs:
check-codeql:
name: Check CodeQL Analysis
runs-on: ubuntu-24.04
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand All @@ -38,7 +36,7 @@ jobs:
build:
needs: check-codeql
runs-on: ubuntu-24.04
runs-on: ubuntu-22.04
strategy:
matrix:
node-version: [20.x, 22.x]
Expand All @@ -53,29 +51,26 @@ jobs:
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ matrix.node-version }}-build-${{
hashFiles('package-lock.json') }}
key: ${{ matrix.node-version }}
restore-keys: |
${{ runner.os }}-node-${{ matrix.node-version }}-build-
${{ runner.os }}-node-${{ matrix.node-version }}-
${{ runner.os }}-node-
${{ matrix.node-version }}
- name: Install dependencies
run: npm ci
- name: Create dist directory
run: mkdir -p dist
- name: Run tests using Mocha framework
run: npm test
continue-on-error: true
# Lint and format code in editor
#- name: Lint code and check formatting
# run: npm run lint
# continue-on-error: true
- name: Build project
run: npm run build
- name: Ensure dist directory exists
run: mkdir -p dist
- name: Copy package.json to dist directory
run: cp package.json dist/

publish-npm:
needs: build
runs-on: ubuntu-24.04
runs-on: ubuntu-22.04
permissions:
contents: read
packages: write
Expand All @@ -91,12 +86,9 @@ jobs:
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-20.x-publish-${{
hashFiles('package-lock.json') }}
key: 20.x
restore-keys: |
${{ runner.os }}-node-20.x-publish-
${{ runner.os }}-node-20.x-
${{ runner.os }}-node-
20.x
- name: Install dependencies
run: npm ci
- name: Set up Git user
Expand All @@ -105,8 +97,6 @@ jobs:
git config --global user.name "SunDevil311"
- name: Increment version
run: npm version patch
- name: Ensure dist directory exists
run: mkdir -p dist
- name: Copy package.json to dist directory
run: cp package.json dist/
- name: Publish package
Expand Down
34 changes: 14 additions & 20 deletions .github/workflows/webpack-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@
name: Build/Test Webpack, Publish to npm

on:
release:
types: [created]
workflow_dispatch:

jobs:
check-codeql:
name: Check CodeQL Analysis
runs-on: ubuntu-24.04
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand All @@ -36,7 +38,7 @@ jobs:
build:
needs: check-codeql
runs-on: ubuntu-24.04
runs-on: ubuntu-22.04
strategy:
matrix:
node-version: [20.x, 22.x]
Expand All @@ -51,29 +53,26 @@ jobs:
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ matrix.node-version }}-build-${{
hashFiles('package-lock.json') }}
key: ${{ matrix.node-version }}
restore-keys: |
${{ runner.os }}-node-${{ matrix.node-version }}-build-
${{ runner.os }}-node-${{ matrix.node-version }}-
${{ runner.os }}-node-
${{ matrix.node-version }}
- name: Install dependencies
run: npm ci
- name: Create dist directory
run: mkdir -p dist
- name: Run tests using Mocha framework
run: npm test
continue-on-error: true
# Lint and format code in editor
#- name: Lint code and check formatting
# run: npm run lint
# continue-on-error: true
- name: Build project
run: npm run build
- name: Ensure dist directory exists
run: mkdir -p dist
- name: Copy package.json to dist directory
run: cp package.json dist/

publish-npm:
needs: build
runs-on: ubuntu-24.04
runs-on: ubuntu-22.04
permissions:
contents: read
packages: write
Expand All @@ -89,12 +88,9 @@ jobs:
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-20.x-publish-${{
hashFiles('package-lock.json') }}
key: 20.x
restore-keys: |
${{ runner.os }}-node-20.x-publish-
${{ runner.os }}-node-20.x-
${{ runner.os }}-node-
20.x
- name: Install dependencies
run: npm ci
- name: Set up Git user
Expand All @@ -103,12 +99,10 @@ jobs:
git config --global user.name "SunDevil311"
- name: Increment version
run: npm version patch
- name: Ensure dist directory exists
run: mkdir -p dist
- name: Copy package.json to dist directory
run: cp package.json dist/
- name: Publish package
working-directory: ./dist
run: npm publish
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 comments on commit d858a0f

Please sign in to comment.