Skip to content
This repository was archived by the owner on Jan 18, 2024. It is now read-only.

Commit a66caa8

Browse files
authored
Merge pull request #50 from xdev-software/update-from-template
Update from template
2 parents 4a63cae + d802283 commit a66caa8

25 files changed

+1073
-559
lines changed

.github/workflows/checkBuild.yml

+4-3
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ jobs:
2222
distribution: [temurin]
2323

2424
steps:
25-
- uses: actions/checkout@v2
25+
- uses: actions/checkout@v3
2626

2727
- name: Set up JDK
28-
uses: actions/setup-java@v2
28+
uses: actions/setup-java@v3
2929
with:
3030
distribution: ${{ matrix.distribution }}
3131
java-version: ${{ matrix.java }}
@@ -53,7 +53,8 @@ jobs:
5353
exit 1
5454
fi
5555
56-
- uses: actions/upload-artifact@v2
56+
- uses: actions/upload-artifact@v3
5757
with:
5858
name: jars-java-${{ matrix.java }}
5959
path: target/*.jar
60+
if-no-files-found: error

.github/workflows/release.yml

+25-22
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,18 @@ on:
44
push:
55
branches: [ master ]
66

7+
permissions:
8+
contents: write
9+
pull-requests: write
10+
711
jobs:
8-
check_code: # Validates the code (see develop.yml)
12+
check_code: # Validates the code (see checkBuild.yml)
913
runs-on: ubuntu-latest
1014
steps:
11-
- uses: actions/checkout@v2
15+
- uses: actions/checkout@v3
1216

13-
- name: Set up JDK 8
14-
uses: actions/setup-java@v2
17+
- name: Set up JDK
18+
uses: actions/setup-java@v3
1519
with:
1620
distribution: 'temurin'
1721
java-version: '8'
@@ -44,7 +48,7 @@ jobs:
4448
outputs:
4549
upload_url: ${{ steps.create_draft.outputs.upload_url }}
4650
steps:
47-
- uses: actions/checkout@v2
51+
- uses: actions/checkout@v3
4852

4953
- name: Configure Git
5054
run: |
@@ -57,7 +61,9 @@ jobs:
5761
- name: Get version
5862
id: version
5963
run: |
60-
echo "::set-output name=release::$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)"
64+
version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
65+
echo "release=$version" >> $GITHUB_OUTPUT
66+
echo "releasenumber=${version//[!0-9]/}" >> $GITHUB_OUTPUT
6167
6268
- name: Commit and Push
6369
run: |
@@ -69,40 +75,38 @@ jobs:
6975
7076
- name: Create Release
7177
id: create_release
72-
uses: actions/create-release@v1
73-
env:
74-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
78+
uses: shogo82148/actions-create-release@v1
7579
with:
7680
tag_name: v${{ steps.version.outputs.release }}
7781
release_name: v${{ steps.version.outputs.release }}
7882
commitish: master
7983
body: |
80-
## Installation [![Maven Central](https://img.shields.io/maven-central/v/com.xdev-software/xapi-db-h2?versionPrefix=${{ steps.version.outputs.release }})](https://mvnrepository.com/artifact/com.xdev-software/xapi-db-h2)
84+
## [Changelog](https://github.com/xdev-software/${{ github.event.repository.name }}/blob/develop/CHANGELOG.md#${{ steps.version.outputs.releasenumber }})
85+
See [Changelog#v${{ steps.version.outputs.release }}](https://github.com/xdev-software/${{ github.event.repository.name }}/blob/develop/CHANGELOG.md#${{ steps.version.outputs.releasenumber }}) for more information.
86+
## Installation
8187
Add the following lines to your pom:
8288
```XML
8389
<dependency>
8490
<groupId>com.xdev-software</groupId>
85-
<artifactId>xapi-db-h2</artifactId>
91+
<artifactId>${{ github.event.repository.name }}</artifactId>
8692
<version>${{ steps.version.outputs.release }}</version>
8793
</dependency>
8894
```
89-
draft: false
90-
prerelease: false
9195
9296
publish_central: # Publish the code to central
9397
runs-on: ubuntu-latest
9498
needs: [prepare_release]
9599
steps:
96-
- uses: actions/checkout@v2
100+
- uses: actions/checkout@v3
97101

98102
- name: Init Git and pull
99103
run: |
100104
git config --global user.email "actions@github.com"
101105
git config --global user.name "GitHub Actions"
102106
git pull
103107
104-
- name: Set up JDK 8 OSSRH
105-
uses: actions/setup-java@v2
108+
- name: Set up JDK OSSRH
109+
uses: actions/setup-java@v3
106110
with: # running setup-java again overwrites the settings.xml
107111
distribution: 'temurin'
108112
java-version: '8'
@@ -124,16 +128,16 @@ jobs:
124128
runs-on: ubuntu-latest
125129
needs: [prepare_release]
126130
steps:
127-
- uses: actions/checkout@v2
131+
- uses: actions/checkout@v3
128132

129133
- name: Init Git and pull
130134
run: |
131135
git config --global user.email "actions@github.com"
132136
git config --global user.name "GitHub Actions"
133137
git pull
134138
135-
- name: Set up JDK 8
136-
uses: actions/setup-java@v2
139+
- name: Set up JDK
140+
uses: actions/setup-java@v3
137141
with:
138142
distribution: 'temurin'
139143
java-version: '8'
@@ -142,7 +146,7 @@ jobs:
142146
run: mvn -B project-info-reports:dependencies
143147

144148
- name: Upload licenses - Upload Artifact
145-
uses: actions/upload-artifact@v2
149+
uses: actions/upload-artifact@v3
146150
with:
147151
name: dependencies-licenses
148152
path: target/site
@@ -176,7 +180,7 @@ jobs:
176180
runs-on: ubuntu-latest
177181
needs: [publish_central]
178182
steps:
179-
- uses: actions/checkout@v2
183+
- uses: actions/checkout@v3
180184

181185
- name: Init Git and pull
182186
run: |
@@ -196,7 +200,6 @@ jobs:
196200
- name: pull-request
197201
uses: repo-sync/pull-request@v2
198202
with:
199-
github_token: ${{ secrets.GITHUB_TOKEN }}
200203
destination_branch: "develop"
201204
pr_title: "Sync back"
202205
pr_body: "An automated PR to sync changes back"

.github/workflows/test-deploy.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ jobs:
77
publish_central: # Publish the code to central
88
runs-on: ubuntu-latest
99
steps:
10-
- uses: actions/checkout@v2
10+
- uses: actions/checkout@v3
1111

12-
- name: Set up JDK 8 OSSRH
13-
uses: actions/setup-java@v2
12+
- name: Set up JDK OSSRH
13+
uses: actions/setup-java@v3
1414
with: # running setup-java again overwrites the settings.xml
1515
distribution: 'temurin'
1616
java-version: '8'
+92
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
name: Update from Template
2+
3+
# This workflow keeps the repo up to date with changes from the template repo (REMOTE_URL)
4+
# It duplicates the REMOTE_BRANCH (into UPDATE_BRANCH) and tries to merge it into the
5+
# this repos default branch (which is checked out here)
6+
# Note that this requires a PAT (Personal Access Token) - at best from a servicing account
7+
# Also note that you should have at least once merged the template repo into the current repo manually
8+
# otherwise a "refusing to merge unrelated histories" error might occur.
9+
10+
on:
11+
schedule:
12+
- cron: '55 2 * * 1'
13+
workflow_dispatch:
14+
15+
env:
16+
UPDATE_BRANCH: update-from-template
17+
REMOTE_URL: https://github.com/xdev-software/xdev-swing-framework-template.git
18+
REMOTE_BRANCH: master
19+
20+
permissions:
21+
contents: write
22+
pull-requests: write
23+
24+
jobs:
25+
update:
26+
runs-on: ubuntu-latest
27+
28+
steps:
29+
- uses: actions/checkout@v3
30+
with:
31+
# Required because otherwise there are always changes detected when executing diff/rev-list
32+
fetch-depth: 0
33+
# If no PAT is used the following error occurs on a push:
34+
# refusing to allow a GitHub App to create or update workflow `.github/workflows/xxx.yml` without `workflows` permission
35+
token: ${{ secrets.UPDATE_FROM_TEMPLATE_PAT }}
36+
37+
- name: Init Git
38+
run: |
39+
git config --global user.email "actions@github.com"
40+
git config --global user.name "GitHub Actions"
41+
42+
- name: Main workflow
43+
id: main
44+
run: |
45+
echo "Adding remote template-repo"
46+
git remote add template ${{ env.REMOTE_URL }}
47+
48+
echo "Fetching remote template repo"
49+
git fetch template
50+
51+
echo "Deleting local branch that will contain the updates - if present"
52+
git branch -D ${{ env.UPDATE_BRANCH }} || true
53+
54+
echo "Checking if the remote template repo has new commits"
55+
git rev-list ..template/${{ env.REMOTE_BRANCH }}
56+
57+
if [ $(git rev-list --count ..template/${{ env.REMOTE_BRANCH }}) -eq 0 ]; then
58+
echo "There are no commits new commits on the template repo"
59+
60+
echo "Deleting origin branch that contains the updates - if present"
61+
git push -f origin --delete ${{ env.UPDATE_BRANCH }} || true
62+
63+
echo "abort=1" >> $GITHUB_OUTPUT
64+
exit 0
65+
fi
66+
67+
echo "Found new commits on the template repo"
68+
69+
echo "Creating update branch"
70+
git branch ${{ env.UPDATE_BRANCH }} template/${{ env.REMOTE_BRANCH }}
71+
git branch --unset-upstream ${{ env.UPDATE_BRANCH }}
72+
73+
echo "Pushing update branch"
74+
git push -f -u origin ${{ env.UPDATE_BRANCH }}
75+
76+
echo "Getting current branch"
77+
current_branch=$(git branch --show-current)
78+
echo "Current branch is $current_branch"
79+
echo "current_branch=$current_branch" >> $GITHUB_OUTPUT
80+
81+
echo "abort=0" >> $GITHUB_OUTPUT
82+
83+
- name: pull-request
84+
uses: repo-sync/pull-request@v2
85+
if: steps.main.outputs.abort == 0
86+
with:
87+
github_token: ${{ secrets.GITHUB_TOKEN }}
88+
source_branch: ${{ env.UPDATE_BRANCH }}
89+
destination_branch: ${{ steps.main.outputs.current_branch }}
90+
pr_title: "Update from template"
91+
pr_body: "An automated PR to sync changes from the template into this repo"
92+

.gitignore

+83-7
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,87 @@
1+
# Maven
12
target/
2-
bin/
3+
pom.xml.tag
4+
pom.xml.releaseBackup
5+
pom.xml.versionsBackup
6+
pom.xml.next
7+
release.properties
8+
dependency-reduced-pom.xml
9+
buildNumber.properties
10+
.mvn/timing.properties
11+
# https://github.com/takari/maven-wrapper#usage-without-binary-jar
12+
.mvn/wrapper/maven-wrapper.jar
313

4-
# IDEA
5-
.idea/
14+
15+
# Compiled class file
16+
*.class
17+
18+
# Log file
19+
*.log
20+
21+
# BlueJ files
22+
*.ctxt
23+
24+
# Mobile Tools for Java (J2ME)
25+
.mtj.tmp/
26+
27+
# Package/Binary Files don't belong into a git repo
28+
*.jar
29+
*.war
30+
*.nar
31+
*.ear
32+
*.zip
33+
*.tar.gz
34+
*.rar
35+
*.dll
36+
*.exe
37+
*.bin
38+
39+
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
40+
hs_err_pid*
41+
42+
43+
# bin / compiled stuff
44+
target/
45+
46+
47+
# JRebel
48+
**/resources/rebel.xml
49+
**/resources/rebel-remote.xml
50+
51+
# eclispe stuff for root
52+
/.settings/
53+
/.classpath
54+
/.project
55+
56+
57+
# eclispe stuff for modules
58+
/*/.metadata/
59+
/*/.apt_generated_tests/
60+
/*/.settings/
61+
/*/.classpath
62+
/*/.project
63+
/*/RemoteSystemsTempFiles/
64+
65+
#custom
66+
.flattened-pom.xml
67+
.tern-project
68+
69+
# == IntelliJ ==
670
*.iml
71+
*.ipr
72+
73+
# Some files are user/installation independent and are used for configuring the IDE
74+
# See also https://stackoverflow.com/a/35279076
75+
76+
.idea/*
77+
!.idea/saveactions_settings.xml
78+
!.idea/checkstyle-idea.xml
79+
80+
!.idea/inspectionProfiles/
81+
.idea/inspectionProfiles/*
82+
!.idea/inspectionProfiles/Project_Default.xml
783

8-
# Eclispe
9-
.settings
10-
.classpath
11-
.project
84+
!.idea/codeStyles/
85+
.idea/codeStyles/*
86+
!.idea/codeStyles/codeStyleConfig.xml
87+
!.idea/codeStyles/Project.xml

.idea/checkstyle-idea.xml

+20
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)