Skip to content

Prepare Release - Visualization/Analysis #1

Prepare Release - Visualization/Analysis

Prepare Release - Visualization/Analysis #1

name: Prepare Release - Visualization/Analysis
on:
workflow_dispatch:
inputs:
repository:
description: 'Repository to release'
required: true
type: choice
options:
- Visualization
- Analysis
version_type:
description: 'Version increment type'
required: true
type: choice
options:
- patch
- minor
- major
jobs:
prepare:
runs-on: ubuntu-latest
outputs:
new_version: ${{ steps.version.outputs.new_version }}
prefix: ${{ steps.version.outputs.prefix }}
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- name: Update version and files
id: version
run: |
set -e
NEW_VERSION=$(bun run script/version-manager.ts ${{ inputs.repository }} ${{ inputs.version_type }})
echo "new_version=${NEW_VERSION}" >> $GITHUB_OUTPUT
echo "prefix=${{ inputs.repository == 'Visualization' && 'vis' || 'ana' }}" >> $GITHUB_OUTPUT
- name: Create release branch and commit changes
run: |
# Create a new branch
git checkout -b release/${{ steps.version.outputs.prefix }}-${{ steps.version.outputs.new_version }}
# Stage and commit changes
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add -A
git commit -m "Releasing ${{ steps.version.outputs.prefix }}-${{ steps.version.outputs.new_version }} [skip ci]"
# Create tag (will be pushed with the merge)
git tag "${{ steps.version.outputs.prefix }}-${{ steps.version.outputs.new_version }}"
# Push branch
git push origin release/${{ steps.version.outputs.prefix }}-${{ steps.version.outputs.new_version }}
- name: Create release pull request
uses: peter-evans/create-pull-request@v5
with:
title: "Release ${{ inputs.repository }} ${{ steps.version.outputs.new_version }}"
body: |
Automated PR for releasing ${{ inputs.repository }} version ${{ steps.version.outputs.new_version }}
This PR was automatically created by the release workflow.
After merging, the tag `${{ steps.version.outputs.prefix }}-${{ steps.version.outputs.new_version }}` will trigger the release workflow.
branch: release/${{ steps.version.outputs.prefix }}-${{ steps.version.outputs.new_version }}
base: main
labels: release
delete-branch: true
# The appropriate release workflow will be triggered after the PR is merged