Skip to content

Build

Build #5

Workflow file for this run

name: Build
on:
workflow_dispatch:
concurrency:
group: build
cancel-in-progress: false
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.REPO_ACCESS_TOKEN }}
- name: Perform linting
run: |
npm install
#npm run lint
build:
needs: test
name: Build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
-
name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.REPO_ACCESS_TOKEN }}
-
name: Generate changelog
id: changelog
uses: requarks/changelog-action@v1
with:
token: ${{ github.token }}
fromTag: ${{ github.ref_name }}
toTag: ${{ vars.TAG }}
writeToFile: false
reverseOrder: true
includeInvalidCommits: true
excludeTypes: "docs,build,chore"
-
name: Setup Git
run: |
git config user.name kroese
git config user.email kroese@users.noreply.github.com
git checkout -b release/v${{ vars.MAJOR }}.${{ vars.MINOR }}
-
name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
-
name: Build
run: |
sed -i "s/0.0.0-development/${{ vars.MAJOR }}.${{ vars.MINOR }}/" package.json
sed -i "s/0.0.0-development/${{ vars.MAJOR }}.${{ vars.MINOR }}/" package-lock.json
npm i -g @vercel/ncc
npm install --omit=dev
npm run build
#npm run build_stats
#npm exec --yes -- webpack-bundle-analyzer dist/stats dist -O -m static
-
name: Clean files
run: |
rm .gitignore
rm -f renovate.json
rm -Rf node_modules/
rm -Rf .github
rm index.js
rm -f dist/stats
rm -f dist/index.js.map
rm -f dist/index.873.js.map
rm -f dist/sourcemap-register.js
-
name: Create Branch release/v${{ vars.MAJOR }}.${{ vars.MINOR }}
run: |
git add .
git commit -m "Auto commit from Github Actions #${{ github.run_id }}"
git push origin release/v${{ vars.MAJOR }}.${{ vars.MINOR }} -f
-
name: Create a release
uses: action-pack/github-release@v2
with:
tag: "v${{ vars.MAJOR }}.${{ vars.MINOR }}"
title: "v${{ vars.MAJOR }}.${{ vars.MINOR }}"
commit: "release/v${{ vars.MAJOR }}.${{ vars.MINOR }}"
body: |
${{ steps.changelog.outputs.changes }}
**Full Changelog**: https://github.com/${{ github.repository }}/compare//${{ vars.TAG }}...v${{ vars.MAJOR }}.${{ vars.MINOR }}
token: ${{ secrets.REPO_ACCESS_TOKEN }}
-
name: Update major release
uses: action-pack/github-release@v2
with:
tag: "v${{ vars.MAJOR }}"
title: "v${{ vars.MAJOR }}"
commit: "release/v${{ vars.MAJOR }}.${{ vars.MINOR }}"
body: |
${{ steps.changelog.outputs.changes }}
**Full Changelog**: https://github.com/${{ github.repository }}/compare//${{ vars.TAG }}...v${{ vars.MAJOR }}.${{ vars.MINOR }}
token: ${{ secrets.REPO_ACCESS_TOKEN }}
-
name: Store tag
uses: action-pack/set-variable@v1
with:
name: 'TAG'
value: 'v${{ vars.MAJOR }}.${{ vars.MINOR }}'
token: ${{ secrets.REPO_ACCESS_TOKEN }}
-
name: Increment version variable
uses: action-pack/bump@v2
with:
token: ${{ secrets.REPO_ACCESS_TOKEN }}