Apply patches to release v1.23.2 #17
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Patch upstream release | |
run-name: Apply patches to release ${{ inputs.tag }} | |
on: | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: 'Specify an upstream version tag' | |
required: true | |
default: 'v1.23.1' | |
jobs: | |
patch-upstream: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
pull-requests: write | |
actions: write | |
steps: | |
- name: Checkout current branch | |
uses: actions/checkout@v3 | |
- name: Move patches | |
run: mv patches /tmp/patches | |
- name: Add upstream and fetch tags | |
run: | | |
git remote add upstream https://github.com/go-gitea/gitea.git | |
git fetch upstream --tags | |
- name: Verify upstream tag exists | |
run: | | |
if ! git rev-parse "refs/tags/${{ inputs.tag }}" >/dev/null 2>&1; then | |
echo "Error: Tag ${{ inputs.tag }} does not exist upstream." | |
exit 1 | |
fi | |
- name: Create branch from determined tag | |
run: git checkout tags/${{ inputs.tag }} -b apply-patches-${{ inputs.tag }} | |
- name: Configure Git user | |
run: | | |
git config --global user.name 'Bart van der Braak' | |
git config --global user.email '[email protected]' | |
- name: Apply patches | |
run: | | |
if ! git am --3way /tmp/patches/*.patch; then | |
echo "Patch application failed." | |
git am --abort | |
exit 1 | |
fi | |
- name: Clean tags and push new | |
run: | | |
git tag -d "${{ inputs.tag }}" || echo "Local tag does not exist, skipping delete." | |
git push --delete origin "${{ inputs.tag }}" || echo "Remote tag does not exist, skipping delete." | |
git tag -a "${{ inputs.tag }}" -m "Tagging version ${{ inputs.tag }} after applying patches" | |
git push origin "${{ inputs.tag }}" | |
echo '{"ref":"${{ inputs.tag }}"}' | gh workflow run build.yml --ref "ci" --repo "blender/gitea" --json | |
env: | |
GH_TOKEN: ${{ github.token }} | |
- name: Push branch | |
if: always() | |
run: git push origin apply-patches-${{ inputs.tag }} --force | |
env: | |
PAT_TOKEN: ${{ secrets.PAT_TOKEN }} | |