Skip to content

Create Release

Create Release #51

name: Create Release
on:
workflow_dispatch:
inputs:
version:
description: 'Version tag (e.g. v1.0.1)'
required: true
type: string
notes:
description: 'Release notes (brief summary of changes)'
required: false
type: string
env:
VERSION_PATTERN: '^v[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?$'
jobs:
create-release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Validate version format
run: |
if [[ ! "${{ inputs.version }}" =~ $VERSION_PATTERN ]]; then
echo "::error::Invalid version format '${{ inputs.version }}'. Must match semver (e.g. v1.0.0, v1.0.0-beta.1)"
exit 1
fi
- uses: actions/checkout@v7
- name: Create tag and release
env:
GH_TOKEN: ${{ github.token }}
RELEASE_NOTES: ${{ inputs.notes || 'No release notes provided.' }}
run: |
if ! git ls-remote --tags origin | grep -q "refs/tags/${{ inputs.version }}$"; then
git tag ${{ inputs.version }}
git push origin ${{ inputs.version }}
else
echo "Tag ${{ inputs.version }} already exists, skipping tag creation"
fi
if ! gh release view ${{ inputs.version }} &>/dev/null; then
printf '%s' "$RELEASE_NOTES" > /tmp/release-notes.txt
gh release create ${{ inputs.version }} \
--title "${{ inputs.version }}" \
--notes-file /tmp/release-notes.txt \
--draft
else
echo "Release ${{ inputs.version }} already exists, continuing"
fi
build:
needs: create-release
strategy:
matrix:
include:
- os: windows-latest
build-cmd: npm run package:win -w requesto-electron
artifact-pattern: 'dist/*.exe dist/latest*.yml'
- os: macos-latest
build-cmd: npm run package:mac -w requesto-electron
artifact-pattern: 'dist/*.dmg dist/*.zip dist/latest*.yml'
- os: ubuntu-latest
build-cmd: npm run package:linux -w requesto-electron
artifact-pattern: 'dist/*.AppImage dist/*.deb dist/latest*.yml'
runs-on: ${{ matrix.os }}
permissions:
contents: write
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v6
with:
node-version: 24
- name: Install dependencies
run: npm install
- name: Set version from release tag
shell: bash
run: |
VERSION="${{ inputs.version }}"
VERSION="${VERSION#v}"
npm pkg set version="$VERSION" -w requesto-electron
- name: Build backend & frontend
run: |
npm run build:backend
npm run build:frontend
- name: Build Electron (${{ matrix.os }})
shell: bash
run: |
npm run build:electron
${{ matrix.build-cmd }}
- name: Upload artifacts to release
env:
GH_TOKEN: ${{ github.token }}
shell: bash
run: |
for file in ${{ matrix.artifact-pattern }}; do
if [ -f "$file" ]; then
gh release upload ${{ inputs.version }} "$file" --clobber
fi
done
docker:
needs: create-release
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v7
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Log in to Docker Hub
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Log in to GitHub Container Registry
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract version
id: version
run: echo "tag=${VERSION#v}" >> "$GITHUB_OUTPUT"
env:
VERSION: ${{ inputs.version }}
- name: Build and push Docker image
uses: docker/build-push-action@v7
with:
context: .
push: true
tags: |
terrii/requesto:latest
terrii/requesto:${{ steps.version.outputs.tag }}
ghcr.io/t3rr11/requesto:latest
ghcr.io/t3rr11/requesto:${{ steps.version.outputs.tag }}
cache-from: type=gha
cache-to: type=gha,mode=max