Skip to content

Commit

Permalink
feat: updated packages (#105)
Browse files Browse the repository at this point in the history
* new CI workflows
* eslint
* dropped semantic-release for release drafter
  • Loading branch information
Bugs5382 authored Nov 17, 2024
2 parents 50eb11d + f081142 commit 8dedec9
Show file tree
Hide file tree
Showing 27 changed files with 742 additions and 617 deletions.
3 changes: 0 additions & 3 deletions .eslintignore

This file was deleted.

8 changes: 0 additions & 8 deletions .github/dependabot.yml

This file was deleted.

15 changes: 0 additions & 15 deletions .github/pr-title-checker-config.json

This file was deleted.

56 changes: 56 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name-template: 'v$RESOLVED_VERSION'
tag-template: 'v$RESOLVED_VERSION'
template: |
## What Changed 👀
$CHANGES
# Extra
**Full Changelog**: https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION
categories:
- title: 🚀 Features
labels:
- feature
- enhancement
- title: 🐛 Bug Fixes
labels:
- fix
- bug
- title: ⚠️ Changes
labels:
- changed
- title: ⛔️ Deprecated
labels:
- deprecated
- title: 🗑 Removed
labels:
- removed
- title: 🔐 Security
labels:
- security
- title: 📄 Documentation
labels:
- docs
- documentation
- title: 🧩 Dependency Updates
labels:
- deps
- dependencies
collapse-after: 5
prerelease-identifier: 'beta'
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.
version-resolver:
major:
labels:
- major
minor:
labels:
- minor
patch:
labels:
- patch
default: patch
exclude-labels:
- skip-changelog
108 changes: 108 additions & 0 deletions .github/workflows/action-deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
name: Release and Publish
on:
release:
types:
- released

permissions:
contents: write
actions: write
checks: write
id-token: write

jobs:
Test:
uses: ./.github/workflows/action-test.yaml

Strip_Version:
runs-on: ubuntu-latest
outputs:
CLEAN_TAG: ${{ steps.set-output.outputs.CLEAN_TAG }}
steps:
- name: Strip "v" from Tag
id: set-output
run: echo "CLEAN_TAG=${GITHUB_EVENT_RELEASE_TAG_NAME#v}" >> $GITHUB_OUTPUT
env:
GITHUB_EVENT_RELEASE_TAG_NAME: ${{ github.event.release.tag_name }}

Publish:
runs-on: ubuntu-latest
outputs:
GIT_BRANCH_TARGET: ${{ steps.set-npm-tag.outputs.GIT_BRANCH_TARGET }}
needs: ['Test', 'Strip_Version']
env:
CLEAN_TAG: ${{ needs.Strip_Version.outputs.CLEAN_TAG }}
steps:
- name: Create Directory
run: mkdir -p ./lib

- name: Download the build artifact
uses: actions/download-artifact@v4
with:
name: cache
path: ./

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
registry-url: 'https://registry.npmjs.org/'

- name: Update Version in Package.json
id: set-npm-tag
run: |
npm version $CLEAN_TAG --no-git-tag-version
if [[ "$CLEAN_TAG" == *"beta"* ]]; then
echo "NPM_TAG=beta" >> $GITHUB_OUTPUT
echo "GIT_BRANCH_TARGET=develop" >> $GITHUB_OUTPUT
else
echo "NPM_TAG=latest" >> $GITHUB_OUTPUT
echo "GIT_BRANCH_TARGET=main" >> $GITHUB_OUTPUT
fi
- name: Publish to npm
uses: JS-DevTools/npm-publish@v3
with:
token: ${{ secrets.NPM_TOKEN }}
tag: ${{ steps.set-npm-tag.outputs.NPM_TAG }}

Update_Repo:
runs-on: ubuntu-latest
needs: ['Test', 'Strip_Version', 'Publish']
permissions:
contents: write
actions: write
checks: write
env:
CLEAN_TAG: ${{ needs.Strip_Version.outputs.CLEAN_TAG }}
GIT_BRANCH_TARGET: ${{ needs.Publish.outputs.GIT_BRANCH_TARGET }}
steps:
# - uses: hmarr/debug-action@v3

- uses: actions/checkout@v4
with:
token: '${{ secrets.GITHUB_TOKEN }}'
ref: ${{ env.GIT_BRANCH_TARGET }}
sparse-checkout: |
package.json
CHANGELOG.md
sparse-checkout-cone-mode: false

- name: Update Version in Package.json
id: set-git-branch
run: npm version $CLEAN_TAG --no-git-tag-version

- name: Update Changelog
uses: stefanzweifel/changelog-updater-action@v1
with:
latest-version: ${{ github.event.release.name }}
release-notes: ${{ github.event.release.body }}

- name: Commit and Push Version Update
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "chore(release): ${{ github.event.release.tag_name }} [skip ci]"

Document:
needs: ['Update_Repo', 'Publish']
uses: ./.github/workflows/action-docs.yaml
36 changes: 36 additions & 0 deletions .github/workflows/docs.yaml → .github/workflows/action-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,42 @@ name: Publish Docs
on:
workflow_dispatch:
workflow_call:

permissions:
contents: write
actions: write
checks: write

jobs:
History:
runs-on: ubuntu-latest
steps:
- name: Check if branch exists
id: branch_check
run: |
if git rev-parse --verify gh-pages >/dev/null 2>&1; then
echo "Branch exists"
echo "exists=true" >> $GITHUB_ENV
else
echo "Branch does not exist"
echo "exists=false" >> $GITHUB_ENV
fi
continue-on-error: true

- name: Get the gh-pages repo
if: env.exists == 'true'
uses: actions/checkout@v4
with:
ref: gh-pages

- name: TAR the existing docs
if: env.exists == 'true'
run: |
mkdir -p ./docs
tar -cvf documentation.tar ./docs
- name: Create a document artifact
if: env.exists == 'true'
uses: actions/upload-artifact@v4
with:
name: documentation
Expand All @@ -38,8 +56,10 @@ jobs:
uses: actions/download-artifact@v4
with:
name: documentation
continue-on-error: true

- run: tar -xf documentation.tar ./docs -C ./docs
continue-on-error: true

- name: Build
uses: actions/setup-node@v4
Expand All @@ -64,7 +84,20 @@ jobs:
needs: Build
runs-on: ubuntu-latest
steps:
- name: Check if branch exists
id: branch_check
run: |
if git rev-parse --verify gh-pages >/dev/null 2>&1; then
echo "Branch exists"
echo "exists=true" >> $GITHUB_ENV
else
echo "Branch does not exist"
echo "exists=false" >> $GITHUB_ENV
fi
continue-on-error: true

- name: Checkout the gh-pages repo
if: env.exists == 'true'
uses: actions/checkout@v4
with:
ref: gh-pages
Expand All @@ -76,14 +109,17 @@ jobs:
uses: actions/download-artifact@v4
with:
name: newdocumentation
continue-on-error: true

- name: Extract Tar
run: tar -xf newdocumentation.tar ./docs -C ./docs

- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
allow_empty_commit: true
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: gh-pages
publish_dir: ./docs
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'
20 changes: 17 additions & 3 deletions .github/workflows/test.yaml → .github/workflows/action-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,16 @@ on:
pull_request:
branches:
- main
- develop
types:
- opened
- reopened
- ready_for_review
- synchronize


jobs:

Build:
runs-on: ubuntu-latest
services:
Expand All @@ -28,15 +33,22 @@ jobs:
with:
node-version: ${{matrix.node-version}}

- name: Run
- name: Pre-Run
run: |
npm install --package-lock-only
npm install --ignore-scripts
npm run build
- name: Run Tests and Lint
run: |
npm run lint
npm run test
env:
RABBITMQ_URL: amqp://guest:guest@localhost:5672

- name: Run Build
run: |
npm run build
- name: Upload build artifact
if: matrix.node-version == 'lts/*'
uses: actions/upload-artifact@v4
Expand All @@ -45,4 +57,6 @@ jobs:
path: |
package.json
package-lock.json
./lib
README.md
LICENSE
./lib
52 changes: 0 additions & 52 deletions .github/workflows/dependabot-action.yml

This file was deleted.

Loading

0 comments on commit 8dedec9

Please sign in to comment.