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

Commit f9b45a3

Browse files
authored
Merge pull request #75 from xdev-software/update-from-template
Update from template
2 parents 83b53dd + 46653cd commit f9b45a3

File tree

18 files changed

+1080
-557
lines changed

18 files changed

+1080
-557
lines changed

.github/workflows/checkBuild.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ on:
1212
- '**.md'
1313

1414
jobs:
15-
build_lts:
15+
build:
1616
runs-on: ubuntu-latest
1717

1818
strategy:
@@ -57,8 +57,9 @@ jobs:
5757
echo "::error::Unstaged changes detected. Locally try running: git clean -ffdx && mvn -B clean verify"
5858
exit 1
5959
fi
60-
60+
6161
- uses: actions/upload-artifact@v3
6262
with:
63-
name: jars-lts-${{ matrix.java }}
63+
name: jars-java-${{ matrix.java }}
6464
path: target/*.jar
65+
if-no-files-found: error

.github/workflows/release.yml

Lines changed: 18 additions & 25 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:
812
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: 'zulu'
@@ -57,11 +61,10 @@ jobs:
5761

5862
- name: Get version
5963
id: version
60-
# Ignores the suffix
6164
run: |
62-
read_version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
63-
parts=(${read_version//-/ })
64-
echo "::set-output name=release::${parts[0]}"
65+
version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
66+
echo "release=$version" >> $GITHUB_OUTPUT
67+
echo "releasenumber=${version//[!0-9]/}" >> $GITHUB_OUTPUT
6568
6669
- name: Commit and Push
6770
run: |
@@ -73,25 +76,23 @@ jobs:
7376
7477
- name: Create Release
7578
id: create_release
76-
uses: actions/create-release@v1
77-
env:
78-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
79+
uses: shogo82148/actions-create-release@v1
7980
with:
8081
tag_name: v${{ steps.version.outputs.release }}
8182
release_name: v${{ steps.version.outputs.release }}
8283
commitish: master
8384
body: |
84-
## Installation [![Maven Central](https://img.shields.io/maven-central/v/com.xdev-software/xapi-fx?versionPrefix=${{ steps.version.outputs.release }})](https://mvnrepository.com/artifact/com.xdev-software/xapi-fx)
85+
## [Changelog](https://github.com/xdev-software/${{ github.event.repository.name }}/blob/develop/CHANGELOG.md#${{ steps.version.outputs.releasenumber }})
86+
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.
87+
## Installation
8588
Add the following lines to your pom:
8689
```XML
8790
<dependency>
8891
<groupId>com.xdev-software</groupId>
89-
<artifactId>xapi-fx</artifactId>
90-
<version>${{ steps.version.outputs.release }}-java<JavaVersion></version>
92+
<artifactId>${{ github.event.repository.name }}</artifactId>
93+
<version>${{ steps.version.outputs.release }}</version>
9194
</dependency>
9295
```
93-
draft: false
94-
prerelease: false
9596
9697
publish_central: # Publish the code to central
9798
runs-on: ubuntu-latest
@@ -114,14 +115,8 @@ jobs:
114115
git config --global user.email "actions@github.com"
115116
git config --global user.name "GitHub Actions"
116117
git pull
117-
118-
# Fixes OSSRH-66257
119-
# See https://issues.sonatype.org/browse/OSSRH-66257?focusedCommentId=1036973&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-1036973
120-
- if: ${{ matrix.java == 17 }}
121-
run: |
122-
echo 'MAVEN_OPTS=--add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.text=ALL-UNNAMED --add-opens=java.desktop/java.awt.font=ALL-UNNAMED' >> $GITHUB_ENV
123118
124-
- name: Set up JDK and configure for ossrh
119+
- name: Set up JDK OSSRH
125120
uses: actions/setup-java@v3
126121
with: # running setup-java again overwrites the settings.xml
127122
distribution: ${{ matrix.distribution }}
@@ -133,16 +128,15 @@ jobs:
133128
gpg-passphrase: MAVEN_GPG_PASSPHRASE
134129
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
135130

136-
- name: Publish to Apache Maven Central
131+
- name: Publish to OSSRH
137132
run: mvn -B deploy -Possrh,java${{ matrix.java }}
138133
env:
139134
MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
140135
MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
141136
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
142137

143138
publish-pages:
144-
# Java 8-variant has no dependencies
145-
name: Publish dependencies and licenses to github pages (Java 11)
139+
name: Publish dependencies and licenses to github pages
146140
runs-on: ubuntu-latest
147141
needs: [prepare_release]
148142
steps:
@@ -154,7 +148,7 @@ jobs:
154148
git config --global user.name "GitHub Actions"
155149
git pull
156150
157-
- name: Set up JDK 11
151+
- name: Set up JDK
158152
uses: actions/setup-java@v3
159153
with:
160154
distribution: 'temurin'
@@ -232,7 +226,6 @@ jobs:
232226
- name: pull-request
233227
uses: repo-sync/pull-request@v2
234228
with:
235-
github_token: ${{ secrets.GITHUB_TOKEN }}
236229
destination_branch: "develop"
237230
pr_title: "Sync back"
238231
pr_body: "An automated PR to sync changes back"

.github/workflows/test-deploy.yml

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
name: Test Deployment
1+
name: Test Deployment CI
22

33
on:
44
workflow_dispatch:
55

66
jobs:
77
publish_central: # Publish the code to central
88
runs-on: ubuntu-latest
9-
109
strategy:
1110
matrix:
1211
java: [11, 17]
@@ -21,13 +20,7 @@ jobs:
2120
steps:
2221
- uses: actions/checkout@v3
2322

24-
# Fixes OSSRH-66257
25-
# See https://issues.sonatype.org/browse/OSSRH-66257?focusedCommentId=1036973&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-1036973
26-
- if: ${{ matrix.java == 17 }}
27-
run: |
28-
echo 'MAVEN_OPTS=--add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.text=ALL-UNNAMED --add-opens=java.desktop/java.awt.font=ALL-UNNAMED' >> $GITHUB_ENV
29-
30-
- name: Set up JDK and configure for ossrh
23+
- name: Set up JDK OSSRH
3124
uses: actions/setup-java@v3
3225
with: # running setup-java again overwrites the settings.xml
3326
distribution: ${{ matrix.distribution }}
@@ -39,7 +32,7 @@ jobs:
3932
gpg-passphrase: MAVEN_GPG_PASSPHRASE
4033
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
4134

42-
- name: Publish to Apache Maven Central
35+
- name: Publish to OSSRH
4336
run: mvn -B deploy -Possrh,java${{ matrix.java }}
4437
env:
4538
MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
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: 82 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +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/
6-
*.iml
714

8-
# Eclispe
9-
.settings
10-
.classpath
11-
.project
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+
1246

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
1366
.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)