Skip to content

manual release

manual release #43

Workflow file for this run

name: manual release
on:
workflow_dispatch:
inputs:
version:
description: 'Version to release'
required: true
force_delete:
description: 'Force delete existing tags'
type: boolean
default: false
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Remove optional "v" prefix
id: version
run: |
echo "version=${VERSION#v}" >> "$GITHUB_OUTPUT"
env:
VERSION: ${{ inputs.version }}
- name: Check if branch and version match
id: guard
run: |
MAJOR_VERSION="${NUMERIC_VERSION%%.*}"
BRANCH_MAJOR_VERSION="${BRANCH%%.*}"
if [ "$MAJOR_VERSION" != "$BRANCH_MAJOR_VERSION" ]; then
echo "Mismatched versions! Aborting."
VERSION_MISMATCH='true';
else
echo "Versions match! Proceeding."
VERSION_MISMATCH='false';
fi
echo "VERSION_MISMATCH=$(echo $VERSION_MISMATCH)" >> "$GITHUB_OUTPUT";
env:
BRANCH: ${{ github.ref_name }}
NUMERIC_VERSION: ${{ steps.version.outputs.version }}
- name: Fail if branch and release tag do not match
if: ${{ steps.guard.outputs.VERSION_MISMATCH == 'true' }}
uses: actions/github-script@v7
with:
script: |
core.setFailed('Workflow failed. Release version does not match with selected target branch. Did you select the correct branch?')
- name: Update Application.php version
run: sed -i "s/const VERSION = '.*';/const VERSION = '${{ steps.version.outputs.version }}';/g" src/foundation/src/Application.php
- name: Commit version change
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "Update version to v${{ steps.version.outputs.version }}"
- name: Setup private key
run: |
mkdir -p ~/.ssh
echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
echo "StrictHostKeyChecking no" >> ~/.ssh/config
env:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Split and push
run: |
git config pull.rebase true
git config --global user.email "[email protected]"
git config --global user.name "Hypervel"
if [ ${{ inputs.force_delete }} = true ]; then
bash ./bin/release.sh v${{ steps.version.outputs.version }} -f
else
bash ./bin/release.sh v${{ steps.version.outputs.version }}
fi
- name: Create release notes
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
name: v${{ steps.version.outputs.version }}
tag_name: v${{ steps.version.outputs.version }}