generated from quarkiverse/quarkiverse-template
-
Notifications
You must be signed in to change notification settings - Fork 60
97 lines (86 loc) · 3.74 KB
/
quarkus-main-rebase.yml
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
90
91
92
93
94
95
96
name: quarkus-main rebase
on:
workflow_dispatch:
schedule:
# Run every day at 2AM
- cron: '0 2 * * *'
env:
LANG: en_US.UTF-8
ISSUE_ID: 1287
DEPENDENCY_SHORT_NAME: quarkus
JAVA_VERSION: 17
concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true
jobs:
rebase-quarkus-main:
if: github.repository == 'quarkiverse/quarkus-cxf'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: rebase-dependency-main-branch
uses: ./.github/actions/rebase-dependency-main-branch
id: rebase-dependency-main-branch
with:
java-version: ${{ env.JAVA_VERSION }}
dependency-git-repo-url: https://github.com/quarkusio/quarkus.git
dependency-short-name: ${{ env.DEPENDENCY_SHORT_NAME }}
issue-id: ${{ env.ISSUE_ID }}
token: "${{ secrets.QUARKIVERSEBOT_TOKEN }}"
- name: Show steps.rebase-dependency-main-branch.outputs.exit-status
shell: bash
run: |
echo "steps.rebuild-dependency.outputs.exit-status: ${{ steps.rebase-dependency-main-branch.outputs.exit-status }}"
- name: build-and-run-jvm-tests
uses: ./.github/actions/build-and-run-jvm-tests
with:
java-version: ${{ env.JAVA_VERSION }}
- name: git push origin ${{ env.DEPENDENCY_SHORT_NAME }}-main -f
shell: bash
run: |
lastCommitMessage="$(git log -1 --pretty=%B)"
echo "Comparing last commit message '$lastCommitMessage' with '${{ steps.rebase-dependency-main-branch.outputs.upgrade-message }}'"
if [[ "$lastCommitMessage" == "${{ steps.rebase-dependency-main-branch.outputs.upgrade-message }}" ]]; then
echo "Removing last commit '$lastCommitMessage'"
git reset --hard HEAD~1
else
echo "Not removing the last commit because its message is not '${{ steps.rebase-dependency-main-branch.outputs.upgrade-message }}' but '$lastCommitMessage'"
fi
git push origin ${{ env.DEPENDENCY_SHORT_NAME }}-main -f
- name: Reopen issue https://github.com/${{ github.repository }}/issues/${{ env.ISSUE_ID }}
if: ${{ steps.rebase-dependency-main-branch.outputs.exit-status != 'success' && failure() }}
shell: bash
run: |
oldState=$(gh issue view ${{ env.ISSUE_ID }} --json state -q .state -R ${{ github.repository }})
echo "oldState = $oldState"
msg="❌ Build with ${{ env.DEPENDENCY_SHORT_NAME }} ${{ steps.rebase-dependency-main-branch.outputs.dependency-commit }} failed in ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
if [[ "$oldState" == "OPEN" ]] ; then
gh issue comment \
--repo ${{ github.repository }} \
--body "$msg" \
${{ env.ISSUE_ID }}
else
gh issue reopen \
--repo ${{ github.repository }} \
--comment "$msg" \
${{ env.ISSUE_ID }}
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Close issue https://github.com/${{ github.repository }}/issues/${{ env.ISSUE_ID }}
if: ${{ success() }}
shell: bash
run: |
oldState=$(gh issue view ${{ env.ISSUE_ID }} --json state -q .state -R ${{ github.repository }})
echo "oldState = $oldState"
msg="✅ Build with ${{ env.DEPENDENCY_SHORT_NAME }} ${{ steps.rebase-dependency-main-branch.outputs.dependency-commit }} succeeded in ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
if [[ "$oldState" != "CLOSED" ]] ; then
gh issue close \
--repo ${{ github.repository }} \
--comment "$msg" \
${{ env.ISSUE_ID }}
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}