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

Commit 136ca21

Browse files
authored
Merge pull request #101 from xdev-software/update-from-template
Update from template
2 parents 3b13a55 + 2005f6d commit 136ca21

File tree

88 files changed

+1879
-1849
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+1879
-1849
lines changed

.github/workflows/checkBuild.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,4 @@ jobs:
5757
with:
5858
name: jars-java-${{ matrix.java }}
5959
path: target/*.jar
60+
if-no-files-found: error

.github/workflows/release.yml

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,22 @@ 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:
1115
- uses: actions/checkout@v3
1216

13-
- name: Set up JDK 8
17+
- name: Set up JDK
1418
uses: actions/setup-java@v3
1519
with:
1620
distribution: 'temurin'
1721
java-version: '8'
1822
cache: 'maven'
19-
2023
- name: Build with Maven
2124
run: mvn -B clean verify
2225

@@ -57,7 +60,9 @@ jobs:
5760
- name: Get version
5861
id: version
5962
run: |
60-
echo "::set-output name=release::$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)"
63+
version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
64+
echo "release=$version" >> $GITHUB_OUTPUT
65+
echo "releasenumber=${version//[!0-9]/}" >> $GITHUB_OUTPUT
6166
6267
- name: Commit and Push
6368
run: |
@@ -69,25 +74,23 @@ jobs:
6974
7075
- name: Create Release
7176
id: create_release
72-
uses: actions/create-release@v1
73-
env:
74-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
77+
uses: shogo82148/actions-create-release@v1
7578
with:
7679
tag_name: v${{ steps.version.outputs.release }}
7780
release_name: v${{ steps.version.outputs.release }}
7881
commitish: master
7982
body: |
83+
## [Changelog](https://github.com/xdev-software/${{ github.event.repository.name }}/blob/develop/CHANGELOG.md#${{ steps.version.outputs.releasenumber }})
84+
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.
8085
## Installation
8186
Add the following lines to your pom:
8287
```XML
8388
<dependency>
8489
<groupId>com.xdev-software</groupId>
85-
<artifactId>biapi</artifactId>
90+
<artifactId>${{ github.event.repository.name }}</artifactId>
8691
<version>${{ steps.version.outputs.release }}</version>
8792
</dependency>
8893
```
89-
draft: false
90-
prerelease: false
9194
9295
publish_central: # Publish the code to central
9396
runs-on: ubuntu-latest
@@ -101,7 +104,7 @@ jobs:
101104
git config --global user.name "GitHub Actions"
102105
git pull
103106
104-
- name: Set up JDK 8 OSSRH
107+
- name: Set up JDK OSSRH
105108
uses: actions/setup-java@v3
106109
with: # running setup-java again overwrites the settings.xml
107110
distribution: 'temurin'
@@ -132,7 +135,7 @@ jobs:
132135
git config --global user.name "GitHub Actions"
133136
git pull
134137
135-
- name: Set up JDK 8
138+
- name: Set up JDK
136139
uses: actions/setup-java@v3
137140
with:
138141
distribution: 'temurin'
@@ -196,7 +199,6 @@ jobs:
196199
- name: pull-request
197200
uses: repo-sync/pull-request@v2
198201
with:
199-
github_token: ${{ secrets.GITHUB_TOKEN }}
200202
destination_branch: "develop"
201203
pr_title: "Sync back"
202204
pr_body: "An automated PR to sync changes back"

.github/workflows/test-deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
steps:
1010
- uses: actions/checkout@v3
1111

12-
- name: Set up JDK 8 OSSRH
12+
- name: Set up JDK OSSRH
1313
uses: actions/setup-java@v3
1414
with: # running setup-java again overwrites the settings.xml
1515
distribution: 'temurin'
Lines changed: 92 additions & 0 deletions
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

Lines changed: 85 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,87 @@
1+
# Maven
12
target/
2-
bin/
3-
.settings
4-
.classpath
5-
.project
3+
pom.xml.tag
4+
pom.xml.releaseBackup
5+
pom.xml.versionsBackup
6+
pom.xml.next
7+
release.properties
68
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
13+
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 ==
70+
*.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
83+
84+
!.idea/codeStyles/
85+
.idea/codeStyles/*
86+
!.idea/codeStyles/codeStyleConfig.xml
87+
!.idea/codeStyles/Project.xml

.idea/checkstyle-idea.xml

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)