Skip to content

Commit

Permalink
feat: 3.1.0 (#113)
Browse files Browse the repository at this point in the history
  • Loading branch information
Bugs5382 authored Nov 16, 2024
2 parents e7e8e99 + 3c34429 commit 773e05d
Show file tree
Hide file tree
Showing 35 changed files with 1,397 additions and 1,493 deletions.
3 changes: 0 additions & 3 deletions .eslintignore

This file was deleted.

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

This file was deleted.

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

This file was deleted.

2 changes: 1 addition & 1 deletion .github/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ version-resolver:
- patch
default: patch
exclude-labels:
- skip-changelog
- 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
125 changes: 125 additions & 0 deletions .github/workflows/action-docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
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 show-ref --verify --quiet refs/heads/gh-pages; 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
path: documentation.tar
Build:
needs: History
runs-on: ubuntu-latest
steps:
- name: Checkout src
uses: actions/checkout@v4

- name: Create Directory
run: mkdir -p ./docs

- name: Download the existing documents artifact
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
with:
node-version: lts/*

- name: Install NPM
run: npm install --ignore-scripts

- name: Build Documents
run: npm run typedoc

- name: Tar the new docs
run: tar -cvf newdocumentation.tar ./docs

- name: Create a new document artifact
uses: actions/upload-artifact@v4
with:
name: newdocumentation
path: newdocumentation.tar
Commit:
needs: Build
runs-on: ubuntu-latest
steps:
- name: Check if branch exists
id: branch_check
run: |
if git show-ref --verify --quiet refs/heads/gh-pages; 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

- name: Create Directory
run: mkdir -p ./docs

- name: Download the new documents artifact
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'
55 changes: 55 additions & 0 deletions .github/workflows/action-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Test
on:
workflow_dispatch:
workflow_call:
pull_request:
branches:
- main
- develop
types:
- opened
- reopened
- ready_for_review
- synchronize


jobs:

Build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x, 'lts/*', 'latest']
steps:
- uses: actions/checkout@v4

- name: Test with Node ${{matrix.node-version}}
uses: actions/setup-node@v4
with:
node-version: ${{matrix.node-version}}

- name: Pre-Run
run: |
npm install --package-lock-only
npm install --ignore-scripts
- name: Run Tests and Lint
run: |
npm run lint
npm run test
- name: Run Build
run: |
npm run build
- name: Upload build artifact
if: matrix.node-version == 'lts/*'
uses: actions/upload-artifact@v4
with:
name: cache
path: |
package.json
package-lock.json
README.md
LICENSE
./lib
61 changes: 0 additions & 61 deletions .github/workflows/dependabot-action.yml

This file was deleted.

Loading

0 comments on commit 773e05d

Please sign in to comment.