From ced5ac9ec64dda0105559ce5687e1ec412fd532c Mon Sep 17 00:00:00 2001 From: darthcav Date: Fri, 10 May 2024 12:41:38 +0200 Subject: [PATCH] Improved gh actions --- .github/workflows/jsdoc-to-gh-pages.yml | 34 +++++++++++++++++++------ .github/workflows/test-node.yml | 4 +-- 2 files changed, 28 insertions(+), 10 deletions(-) diff --git a/.github/workflows/jsdoc-to-gh-pages.yml b/.github/workflows/jsdoc-to-gh-pages.yml index 9cf644c..ae8f2d7 100644 --- a/.github/workflows/jsdoc-to-gh-pages.yml +++ b/.github/workflows/jsdoc-to-gh-pages.yml @@ -7,7 +7,7 @@ on: branches: [ "dev" ] jobs: - gh-pages: + build: runs-on: ubuntu-latest strategy: @@ -16,9 +16,9 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v4.1.5 - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4 + uses: actions/setup-node@v4.0.2 with: node-version: ${{ matrix.node-version }} cache: "npm" @@ -28,9 +28,27 @@ jobs: run: npm run build --if-present - name: Generate JSDoc run: npm run docs - - name: Deploy to GitHub Pages - uses: JamesIves/github-pages-deploy-action@4.1.5 + + deploy: + needs: build + + runs-on: ubuntu-latest + + steps: + - name: Deploy to gh-pages # Deploy documentation to gh-pages branch + uses: actions/checkout@v4.1.5 with: - token: ${{ secrets.GH_PAGES_TOKEN }} - branch: gh-pages # The branch the action should deploy to. - folder: public \ No newline at end of file + ref: gh-pages + repository: ${{ github.repository }} + token: ${{ secrets.GITHUB_TOKEN }} + - name: Clear existing content (optional) + run: rm -rf ./public # This will remove all existing files in the gh-pages branch + - name: Copy docs to gh-pages + run: cp -r ./public/* . # Copy generated documentation to the branch + - name: Commit changes + run: | + git config user.name "darthcav" + git add . + git commit -m "Deploy JSDoc documentation" + - name: Push to gh-pages + run: git push origin gh-pages diff --git a/.github/workflows/test-node.yml b/.github/workflows/test-node.yml index 43a8d43..65bac2d 100644 --- a/.github/workflows/test-node.yml +++ b/.github/workflows/test-node.yml @@ -18,9 +18,9 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v4.1.5 - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4 + uses: actions/setup-node@v4.0.2 with: node-version: ${{ matrix.node-version }} cache: "npm"