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

Commit 6280259

Browse files
Merge remote-tracking branch 'upstream/master' into update-from-template
2 parents ccf18f6 + ff7daea commit 6280259

File tree

15 files changed

+1113
-602
lines changed

15 files changed

+1113
-602
lines changed

.github/workflows/checkBuild.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717

1818
strategy:
1919
matrix:
20-
java: [8, 11, 17]
20+
java: [8, 11, 17]
2121
java-package: [jdk]
2222
distribution: [temurin]
2323

@@ -63,3 +63,4 @@ jobs:
6363
with:
6464
name: jars-java-${{ matrix.java }}
6565
path: target/*.jar
66+
if-no-files-found: error

.github/workflows/release.yml

Lines changed: 21 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,17 @@ 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'
@@ -63,7 +67,9 @@ jobs:
6367
- name: Get version
6468
id: version
6569
run: |
66-
echo "::set-output name=release::$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)"
70+
version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
71+
echo "release=$version" >> $GITHUB_OUTPUT
72+
echo "releasenumber=${version//[!0-9]/}" >> $GITHUB_OUTPUT
6773
6874
- name: Commit and Push
6975
run: |
@@ -75,25 +81,23 @@ jobs:
7581
7682
- name: Create Release
7783
id: create_release
78-
uses: actions/create-release@v1
79-
env:
80-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
84+
uses: shogo82148/actions-create-release@v1
8185
with:
8286
tag_name: v${{ steps.version.outputs.release }}
8387
release_name: v${{ steps.version.outputs.release }}
8488
commitish: master
8589
body: |
86-
## Installation [![Maven Central](https://img.shields.io/maven-central/v/com.xdev-software/csapi?versionPrefix=${{ steps.version.outputs.release }})](https://mvnrepository.com/artifact/com.xdev-software/csapi)
90+
## [Changelog](https://github.com/xdev-software/${{ github.event.repository.name }}/blob/develop/CHANGELOG.md#${{ steps.version.outputs.releasenumber }})
91+
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.
92+
## Installation
8793
Add the following lines to your pom:
8894
```XML
8995
<dependency>
9096
<groupId>com.xdev-software</groupId>
91-
<artifactId>csapi</artifactId>
97+
<artifactId>${{ github.event.repository.name }}</artifactId>
9298
<version>${{ steps.version.outputs.release }}</version>
9399
</dependency>
94100
```
95-
draft: false
96-
prerelease: false
97101
98102
publish_central: # Publish the code to central
99103
runs-on: ubuntu-latest
@@ -107,32 +111,20 @@ jobs:
107111
git config --global user.name "GitHub Actions"
108112
git pull
109113
110-
- name: Set up JDK 8 OSSRH
114+
- name: Set up JDK OSSRH
111115
uses: actions/setup-java@v3
112116
with: # running setup-java again overwrites the settings.xml
113117
distribution: 'temurin'
114118
java-version: '8'
115-
# server-id: ossrh
116-
# server-username: MAVEN_CENTRAL_USERNAME
117-
# server-password: MAVEN_CENTRAL_TOKEN
118-
# gpg-passphrase: MAVEN_GPG_PASSPHRASE
119+
server-id: ossrh
120+
server-username: MAVEN_CENTRAL_USERNAME
121+
server-password: MAVEN_CENTRAL_TOKEN
122+
gpg-passphrase: MAVEN_GPG_PASSPHRASE
119123
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
120-
# Due to https://github.com/actions/setup-java/issues/85 we can only
121-
# add ONE server using setup-java...
122-
overwrite-settings: false
123-
124-
# ... so let's simply copy a predefined settings.xml file into the m2 folder
125-
# until GH makes it work
126-
- name: Copy predefined settings into home m2 folder
127-
run: |
128-
mkdir -p ~/.m2/
129-
cp .github/workflows/maven/m2-settings-release.xml ~/.m2/settings.xml
130124

131125
- name: Publish to OSSRH
132-
run: mvn -B deploy -Pxdev-build,ossrh
126+
run: mvn -B deploy -Possrh
133127
env:
134-
JFROG_ARTIFACTORY_USERNAME: ${{ secrets.JFROG_ARTIFACTORY_USERNAME }}
135-
JFROG_ARTIFACTORY_TOKEN: ${{ secrets.JFROG_ARTIFACTORY_TOKEN }}
136128
MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
137129
MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
138130
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
@@ -150,7 +142,7 @@ jobs:
150142
git config --global user.name "GitHub Actions"
151143
git pull
152144
153-
- name: Set up JDK 8
145+
- name: Set up JDK
154146
uses: actions/setup-java@v3
155147
with:
156148
distribution: 'temurin'
@@ -220,7 +212,6 @@ jobs:
220212
- name: pull-request
221213
uses: repo-sync/pull-request@v2
222214
with:
223-
github_token: ${{ secrets.GITHUB_TOKEN }}
224215
destination_branch: "develop"
225216
pr_title: "Sync back"
226217
pr_body: "An automated PR to sync changes back"

.github/workflows/test-deploy.yml

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,32 +9,20 @@ 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'
1616
java-version: '8'
17-
# server-id: ossrh
18-
# server-username: MAVEN_CENTRAL_USERNAME
19-
# server-password: MAVEN_CENTRAL_TOKEN
20-
# gpg-passphrase: MAVEN_GPG_PASSPHRASE
17+
server-id: ossrh
18+
server-username: MAVEN_CENTRAL_USERNAME
19+
server-password: MAVEN_CENTRAL_TOKEN
20+
gpg-passphrase: MAVEN_GPG_PASSPHRASE
2121
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
22-
# Due to https://github.com/actions/setup-java/issues/85 we can only
23-
# add ONE server using setup-java...
24-
overwrite-settings: false
25-
26-
# ... so let's simply copy a predefined settings.xml file into the m2 folder
27-
# until GH makes it work
28-
- name: Copy predefined settings into home m2 folder
29-
run: |
30-
mkdir -p ~/.m2/
31-
cp .github/workflows/maven/m2-settings-release.xml ~/.m2/settings.xml
3222

3323
- name: Publish to OSSRH
34-
run: mvn -B deploy -Pxdev-build,ossrh
24+
run: mvn -B deploy -Possrh
3525
env:
36-
JFROG_ARTIFACTORY_USERNAME: ${{ secrets.JFROG_ARTIFACTORY_USERNAME }}
37-
JFROG_ARTIFACTORY_TOKEN: ${{ secrets.JFROG_ARTIFACTORY_TOKEN }}
3826
MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
3927
MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
4028
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
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 & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,87 @@
1+
# Maven
12
target/
2-
bin/
3-
.settings
4-
.classpath
5-
.project
6-
.checkstyle
3+
pom.xml.tag
4+
pom.xml.releaseBackup
5+
pom.xml.versionsBackup
6+
pom.xml.next
7+
release.properties
78
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)