Skip to content

Merge pull request #37 from jamiefdhurst/fix-sorting-for-folders #12

Merge pull request #37 from jamiefdhurst/fix-sorting-for-folders

Merge pull request #37 from jamiefdhurst/fix-sorting-for-folders #12

Workflow file for this run

name: Build
on:
push:
branches:
- 'main'
paths:
- '*.js'
- '*.mjs'
- '*.json'
- '*.ts'
- '*.md'
- 'docs/**'
- 'src/**'
permissions:
contents: write
id-token: write
jobs:
Build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
token: ${{ secrets.PAT }}
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version: '20'
cache: 'npm'
registry-url: 'https://registry.npmjs.org/'
- name: Install Dependencies
run: |
npm i
- name: Calculate Next Version
id: version
run: |
chmod +x .github/scripts/calculate-version.sh
.github/scripts/calculate-version.sh
- name: Update Version in package.json
if: steps.version.outputs.should_release == 'true'
run: |
CURRENT_VERSION=$(node -p "require('./package.json').version")
echo "Current version in package.json: $CURRENT_VERSION"
echo "New version: ${{ steps.version.outputs.version }}"
sed -i.bak "s/\"version\": \"$CURRENT_VERSION\"/\"version\": \"${{ steps.version.outputs.version }}\"/" package.json
rm package.json.bak 2>/dev/null || true
echo "Updated package.json"
- name: Update Version Script
if: steps.version.outputs.should_release == 'true'
run: VERSION=${{ steps.version.outputs.version }} npm run version
- name: File Save Delay
if: steps.version.outputs.should_release == 'true'
uses: jakejarvis/wait-action@master
with:
time: '2s'
- name: Generate Changelog
if: steps.version.outputs.should_release == 'true'
uses: orhun/git-cliff-action@v4
with:
config: cliff.toml
args: --verbose --tag ${{ steps.version.outputs.version }}
env:
OUTPUT: CHANGELOG.md
- name: Commit Version and Changelog Changes
if: steps.version.outputs.should_release == 'true'
uses: stefanzweifel/git-auto-commit-action@v7
with:
commit_message: "[skip ci] Update version to v${{ steps.version.outputs.version }}"
file_pattern: "manifest.json package.json versions.json CHANGELOG.md"
- name: Build
if: steps.version.outputs.should_release == 'true'
run: npm run build
- name: Generate Release Notes
if: steps.version.outputs.should_release == 'true'
id: release_notes
run: |
chmod +x .github/scripts/release-notes.sh
.github/scripts/release-notes.sh ${{ steps.version.outputs.version }}
- name: Create Release
if: steps.version.outputs.should_release == 'true'
uses: ncipollo/[email protected]
with:
allowUpdates: true
artifacts: 'main.js,manifest.json,styles.css'
bodyFile: 'release_notes.md'
draft: false
makeLatest: true
tag: ${{ steps.version.outputs.version }}
name: ${{ steps.version.outputs.version }}