Skip to content

Merge pull request #50 from LonoxX/develop #34

Merge pull request #50 from LonoxX/develop

Merge pull request #50 from LonoxX/develop #34

Workflow file for this run

name: Release Workflow
on:
push:
branches: [master]
permissions:
contents: write
pull-requests: write
jobs:
check-version:
runs-on: ubuntu-latest
outputs:
hasNextVersion: ${{ steps.version.outputs.hasNextVersion }}
version: ${{ steps.version.outputs.version }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get next version
uses: thenativeweb/get-next-version@2.6.3
id: version
build-and-release:
runs-on: ubuntu-latest
needs: check-version
if: needs.check-version.outputs.hasNextVersion == 'true'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Use Node.js 22
uses: actions/setup-node@v2
with:
node-version: "22"
- name: Install Dependencies
run: npm install
- name: Build
run: npm run build
- name: Update version files
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
CURRENT_VERSION=$(node -p "require('./package.json').version")
NEW_VERSION="${{ needs.check-version.outputs.version }}"
if [ "$CURRENT_VERSION" != "$NEW_VERSION" ]; then
npm version $NEW_VERSION --no-git-tag-version
npm run version
fi
- name: Build plugin
run: npm run build
- name: Verify build artifacts
run: |
test -f dist/main.js
test -f dist/manifest.json
test -f dist/styles.css
- name: Commit and push version changes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
NEW_VERSION="${{ needs.check-version.outputs.version }}"
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
if ! git diff --quiet || ! git diff --cached --quiet; then
git add package.json manifest.json versions.json
git commit -m "chore: bump version to $NEW_VERSION [skip ci]"
git push origin master
fi
- name: Create and push tag
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
NEW_VERSION="${{ needs.check-version.outputs.version }}"
git tag $NEW_VERSION
git push origin $NEW_VERSION
- name: Create GitHub release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
NEW_VERSION="${{ needs.check-version.outputs.version }}"
gh release create $NEW_VERSION \
--title "$NEW_VERSION" \
--notes "Automated release $NEW_VERSION" \
--latest \
dist/main.js \
dist/manifest.json \
dist/styles.css