Skip to content

Commit 616af13

Browse files
committed
Separate out CI workflows for patching and building
1 parent eaa5b07 commit 616af13

File tree

3 files changed

+123
-152
lines changed

3 files changed

+123
-152
lines changed

.github/workflows/build.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Build and Publish
2+
run-name: Build and publish Docker image for ${{ github.event_name == 'workflow_dispatch' && inputs.ref || github.ref_name }}
3+
4+
on:
5+
workflow_dispatch:
6+
inputs:
7+
ref:
8+
description: 'Ref to build'
9+
required: true
10+
push:
11+
tags:
12+
'*'
13+
14+
jobs:
15+
build:
16+
runs-on: ubuntu-latest
17+
permissions:
18+
contents: read
19+
packages: write
20+
id-token: write
21+
22+
steps:
23+
- name: Checkout code
24+
uses: actions/checkout@v3
25+
with:
26+
ref: ${{ github.event_name == 'workflow_dispatch' && inputs.ref || github.ref_name }}
27+
fetch-depth: 0
28+
29+
- uses: actions/setup-go@v5
30+
with:
31+
go-version-file: go.mod
32+
check-latest: true
33+
34+
- uses: docker/setup-qemu-action@v3
35+
- uses: docker/setup-buildx-action@v3
36+
37+
- name: Login to Docker Hub
38+
uses: docker/login-action@v3
39+
with:
40+
registry: ghcr.io
41+
username: ${{ github.actor }}
42+
password: ${{ secrets.GITHUB_TOKEN }}
43+
44+
- name: Fetch Go modules
45+
run: make vendor
46+
47+
- name: Build and push rootless Docker image
48+
uses: docker/build-push-action@v5
49+
with:
50+
context: .
51+
platforms: linux/amd64
52+
push: true
53+
file: Dockerfile.rootless
54+
tags: ghcr.io/${{ github.repository }}:${{ github.event_name == 'workflow_dispatch' && inputs.ref || github.ref_name }}

.github/workflows/patch-release.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Patch upstream release
2+
run-name: Apply patches to release ${{ inputs.tag }}
3+
4+
on:
5+
workflow_dispatch:
6+
inputs:
7+
tag:
8+
description: 'Specify an upstream version tag'
9+
required: true
10+
default: 'v1.23.1'
11+
12+
jobs:
13+
patch-upstream:
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: write
17+
pull-requests: write
18+
actions: write
19+
steps:
20+
- name: Checkout current branch
21+
uses: actions/checkout@v3
22+
23+
- name: Move patches
24+
run: mv patches /tmp/patches
25+
26+
- name: Add upstream and fetch tags
27+
run: |
28+
git remote add upstream https://github.com/go-gitea/gitea.git
29+
git fetch upstream --tags
30+
31+
- name: Verify upstream tag exists
32+
run: |
33+
if ! git rev-parse "refs/tags/${{ inputs.tag }}" >/dev/null 2>&1; then
34+
echo "Error: Tag ${{ inputs.tag }} does not exist upstream."
35+
exit 1
36+
fi
37+
38+
- name: Create branch from determined tag
39+
run: git checkout tags/${{ inputs.tag }} -b apply-patches-${{ inputs.tag }}
40+
41+
- name: Configure Git user
42+
run: |
43+
git config --global user.name 'Bart van der Braak'
44+
git config --global user.email '[email protected]'
45+
46+
- name: Apply patches
47+
run: |
48+
if ! git am --3way /tmp/patches/*.patch; then
49+
echo "Patch application failed."
50+
git am --abort
51+
exit 1
52+
fi
53+
54+
- name: Clean tags and push new
55+
run: |
56+
git tag -d "${{ inputs.tag }}" || echo "Local tag does not exist, skipping delete."
57+
git push --delete origin "${{ inputs.tag }}" || echo "Remote tag does not exist, skipping delete."
58+
git tag -a "${{ inputs.tag }}" -m "Tagging version ${{ inputs.tag }} after applying patches"
59+
git push origin "${{ inputs.tag }}"
60+
echo '{"ref":"${{ inputs.tag }}"}' | gh workflow run build.yml --ref "ci" --repo "blender/gitea" --json
61+
env:
62+
GH_TOKEN: ${{ github.token }}
63+
64+
- name: Push branch
65+
if: always()
66+
run: git push origin apply-patches-${{ inputs.tag }} --force
67+
env:
68+
PAT_TOKEN: ${{ secrets.PAT_TOKEN }}
69+

.github/workflows/sync-and-apply-patches.yml

Lines changed: 0 additions & 152 deletions
This file was deleted.

0 commit comments

Comments
 (0)