Skip to content

Release

Release #22

Workflow file for this run

name: Release
# Triggered by pushing a version tag (e.g. git tag v1.5.0 && git push origin v1.5.0)
# or manually via workflow_dispatch (useful for re-running on an existing tag like v1.4.1).
on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
tag:
description: 'Release tag to build (e.g. v1.4.1)'
required: true
default: 'v1.4.1'
env:
# Works for both triggers: dispatch overrides, push falls back to ref_name
TAG: ${{ inputs.tag || github.ref_name }}
DOCKER_IMAGE: wycca1/makeslide-app
jobs:
# ──────────────────────────────────────────────
# 1. Ensure the GitHub Release exists
# ──────────────────────────────────────────────
create-release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Create or update release with Docker usage
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG="${{ env.TAG }}"
IMAGE="${{ env.DOCKER_IMAGE }}:${TAG}"
REPO="${{ github.repository }}"
DOCKER_BLOCK="## Docker Image
\`\`\`bash
docker pull ${IMAGE}
docker run --rm -p 8888:8888 --env-file .env ${IMAGE}
\`\`\`"
if EXISTING=$(gh release view "$TAG" --repo "$REPO" --json body -q '.body' 2>/dev/null); then
# Release exists — append Docker block only if not already present
if ! echo "$EXISTING" | grep -q "docker pull"; then
printf '%s\n\n%s\n' "$EXISTING" "$DOCKER_BLOCK" > /tmp/notes.txt
gh release edit "$TAG" --repo "$REPO" --notes-file /tmp/notes.txt
fi
else
# New release — create with Docker block as initial notes
printf '%s\n' "$DOCKER_BLOCK" > /tmp/notes.txt
gh release create "$TAG" --repo "$REPO" \
--title "$TAG" --notes-file /tmp/notes.txt
fi
# ──────────────────────────────────────────────
# 2. Build & push Docker image
# ──────────────────────────────────────────────
docker:
needs: create-release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ env.TAG }}
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
run: |
docker build -t wycca1/makeslide-app:${{ env.TAG }} .
docker push wycca1/makeslide-app:${{ env.TAG }}
# ──────────────────────────────────────────────
# 3. Build Windows exe (windows-latest for correct native binaries)
# ──────────────────────────────────────────────
dist-win:
needs: create-release
runs-on: windows-latest
permissions:
contents: write
steps:
# Check out the branch that triggered this workflow (master for
# workflow_dispatch; the tag itself for push:tags — from v1.4.2 onward
# all tags will include the electron code).
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
# Sync package.json version with the release tag so the output filename
# matches: MakeSlide-1.4.1-win-x64.zip
- name: Set version from tag
shell: bash
run: |
VERSION="${{ env.TAG }}"
VERSION="${VERSION#v}"
node -e "
const fs = require('fs');
const p = JSON.parse(fs.readFileSync('package.json', 'utf8'));
p.version = '$VERSION';
fs.writeFileSync('package.json', JSON.stringify(p, null, 2) + '\n');
"
# Bypass scripts/with-node-env.sh (bash-only wrapper, not needed on CI)
- name: Build backend (tsc)
working-directory: backend
run: npx tsc -p tsconfig.json
# Bundle backend as CJS so Electron's asar-patched require() can resolve
# native addons (better-sqlite3, canvas, sharp…) in app.asar.unpacked.
- name: Bundle backend for Electron (esbuild CJS)
working-directory: backend
run: npm run build:bundle
- name: Build frontend
working-directory: frontend
run: |
npx tsc --noEmit
npx vite build
- name: Build Electron main
run: npx tsc -p electron/tsconfig.json
- name: Package Windows exe
run: npx electron-builder --win --config electron-builder.json --publish never
- name: Upload installer and zip to release
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
VERSION="${{ env.TAG }}"
VERSION="${VERSION#v}"
REPO="${{ github.repository }}"
# Upload installer (.exe) if present, then the portable zip
if ls dist-electron/*Setup*.exe 2>/dev/null; then
gh release upload "${{ env.TAG }}" dist-electron/*Setup*.exe \
--repo "$REPO" --clobber
fi
gh release upload "${{ env.TAG }}" \
"dist-electron/MakeSlide-${VERSION}-win-x64.zip" \
--repo "$REPO" --clobber