-
-
Notifications
You must be signed in to change notification settings - Fork 81
89 lines (76 loc) · 3.11 KB
/
auto-update.yml
File metadata and controls
89 lines (76 loc) · 3.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
name: Automated Update
on:
schedule:
- cron: "0 5 * * 1"
workflow_dispatch:
permissions:
contents: write
pull-requests: write
jobs:
auto-update:
name: Bump GitKraken Package
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8
with:
fetch-depth: 0
persist-credentials: false
- name: Capture current version
id: current
run: |
prev=$(grep '^pkgver=' gitkraken-aur/PKGBUILD | cut -d= -f2)
pkgrel=$(grep '^pkgrel=' gitkraken-aur/PKGBUILD | cut -d= -f2)
{
echo "previous=$prev"
echo "previous_pkgrel=$pkgrel"
} >> "$GITHUB_OUTPUT"
- name: Build update container
run: docker build --platform=linux/amd64 -t gitkraken-update .
- name: Run update script in container
run: docker run --platform=linux/amd64 --rm -v "${{ github.workspace }}":/work -w /work gitkraken-update ./update.sh
- name: Run namcap in container
run: docker run --platform=linux/amd64 --rm -v "${{ github.workspace }}":/work -w /work gitkraken-update bash -lc 'if [ -f gitkraken-aur/.SRCINFO ]; then namcap gitkraken-aur/PKGBUILD gitkraken-aur/.SRCINFO; else namcap gitkraken-aur/PKGBUILD; fi'
- name: Capture updated version
id: updated
run: |
new=$(grep '^pkgver=' gitkraken-aur/PKGBUILD | cut -d= -f2)
pkgrel=$(grep '^pkgrel=' gitkraken-aur/PKGBUILD | cut -d= -f2)
{
echo "new=$new"
echo "pkgrel=$pkgrel"
} >> "$GITHUB_OUTPUT"
- name: Export version metadata
env:
PREVIOUS_VERSION: ${{ steps.current.outputs.previous }}
PREVIOUS_PKGREL: ${{ steps.current.outputs.previous_pkgrel }}
NEW_VERSION: ${{ steps.updated.outputs.new }}
NEW_PKGREL: ${{ steps.updated.outputs.pkgrel }}
run: |
{
echo "PREVIOUS_VERSION=$PREVIOUS_VERSION"
echo "PREVIOUS_PKGREL=$PREVIOUS_PKGREL"
echo "NEW_VERSION=$NEW_VERSION"
echo "NEW_PKGREL=$NEW_PKGREL"
} >> "$GITHUB_ENV"
- name: Detect changes
id: diff
run: |
if git diff --quiet; then
echo "has_changes=false" >> "$GITHUB_OUTPUT"
else
git status --short
echo "has_changes=true" >> "$GITHUB_OUTPUT"
fi
- name: Create pull request
if: steps.diff.outputs.has_changes == 'true'
uses: peter-evans/create-pull-request@84ae59a2cdc2258d6fa0732dd66352dddae2a412 # v7.0.9
with:
commit-message: "gitkraken: ${{ env.PREVIOUS_VERSION }} -> ${{ env.NEW_VERSION }}"
title: "gitkraken: ${{ env.PREVIOUS_VERSION }} -> ${{ env.NEW_VERSION }}"
branch: chore/gitkraken-auto-update
body: |
Automated update triggered by scheduled workflow.
- Ran `./update.sh` inside `archlinux:base-devel`
- `namcap` output captured in workflow logs
If additional changes are required, push to this branch and re-run checks.