Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 0 additions & 42 deletions .github/workflows/docker-image.yml

This file was deleted.

141 changes: 141 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
name: Release

on:
workflow_dispatch:
inputs:
version_bump:
description: 'Version bump type'
required: true
type: choice
options:
- patch
- minor
- major
prerelease:
description: 'Mark as pre-release'
required: false
type: boolean
default: false

jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Bump version (local only)
id: bump
run: |
# Get current version
CURRENT_VERSION=$(node -p "require('./package.json').version")
echo "Current version: $CURRENT_VERSION"

# Bump version using npm (doesn't create git tag)
npm version ${{ inputs.version_bump }} --no-git-tag-version

# Update package-lock.json
npm install --package-lock-only --ignore-scripts

# Get new version
NEW_VERSION=$(node -p "require('./package.json').version")
echo "New version: $NEW_VERSION"

# Set outputs
echo "current_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
echo "tag=v$NEW_VERSION" >> $GITHUB_OUTPUT

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push Docker image (includes tests)
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: |
bryntum/pdf-export-server:${{ steps.bump.outputs.new_version }}
bryntum/pdf-export-server:latest
cache-from: type=gha
cache-to: type=gha,mode=max

# Only commit/tag/release if Docker build succeeded
- name: Configure Git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"

- name: Commit version bump
run: |
git add package.json package-lock.json
git commit -m "chore: bump version to ${{ steps.bump.outputs.new_version }}"
git push

- name: Create and push tag
run: |
git tag ${{ steps.bump.outputs.tag }}
git push origin ${{ steps.bump.outputs.tag }}

- name: Generate release notes
id: release_notes
run: |
# Get commits since last tag (exclude the version bump commit)
LAST_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "")

if [ -n "$LAST_TAG" ]; then
echo "Generating notes from $LAST_TAG to HEAD^"
COMMITS=$(git log $LAST_TAG..HEAD^ --pretty=format:"- %s (%h)" --no-merges)
else
echo "No previous tag found, using recent commits"
COMMITS=$(git log -20 --pretty=format:"- %s (%h)" --no-merges | grep -v "chore: bump version" || true)
fi

# Create release notes
NOTES="## What's Changed

$COMMITS

**Full Changelog**: https://github.com/${{ github.repository }}/compare/$LAST_TAG...${{ steps.bump.outputs.tag }}"

# Save to file for the release step
echo "$NOTES" > release_notes.md
cat release_notes.md

- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.bump.outputs.tag }}
name: ${{ steps.bump.outputs.tag }}
body_path: release_notes.md
prerelease: ${{ inputs.prerelease }}
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Summary
run: |
echo "## Release Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "- **Previous version:** ${{ steps.bump.outputs.current_version }}" >> $GITHUB_STEP_SUMMARY
echo "- **New version:** ${{ steps.bump.outputs.new_version }}" >> $GITHUB_STEP_SUMMARY
echo "- **Tag:** ${{ steps.bump.outputs.tag }}" >> $GITHUB_STEP_SUMMARY
echo "- **Pre-release:** ${{ inputs.prerelease }}" >> $GITHUB_STEP_SUMMARY
echo "- **Docker image:** bryntum/pdf-export-server:${{ steps.bump.outputs.new_version }}" >> $GITHUB_STEP_SUMMARY
Loading