Skip to content
This repository was archived by the owner on Jun 27, 2023. It is now read-only.

Commit 5ddd618

Browse files
authored
Merge pull request #9 from xdev-software/refactoring
Preperations for release
2 parents 9ff5094 + e97862e commit 5ddd618

File tree

3 files changed

+355
-32
lines changed

3 files changed

+355
-32
lines changed

.github/workflows/release.yml

Lines changed: 220 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,220 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
7+
jobs:
8+
check_code: # Validates the code (see develop.yml)
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v2
12+
13+
- name: Set up JDK 8
14+
uses: actions/setup-java@v2
15+
with:
16+
distribution: 'zulu'
17+
java-version: '8'
18+
java-package: jdk+fx
19+
20+
- name: Cache local Maven repository
21+
uses: actions/cache@v2
22+
with:
23+
path: ~/.m2/repository
24+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
25+
restore-keys: |
26+
${{ runner.os }}-maven-
27+
28+
- name: Build with Maven
29+
run: mvn -B clean verify
30+
31+
- name: Check for uncommited changes
32+
run: |
33+
if [[ "$(git status --porcelain)" != "" ]]; then
34+
echo ----------------------------------------
35+
echo git status
36+
echo ----------------------------------------
37+
git status
38+
echo ----------------------------------------
39+
echo git diff
40+
echo ----------------------------------------
41+
git diff
42+
echo ----------------------------------------
43+
echo Troubleshooting
44+
echo ----------------------------------------
45+
echo "::error::Unstaged changes detected. Locally try running: git clean -ffdx && mvn -B clean verify"
46+
exit 1
47+
fi
48+
49+
prepare_release:
50+
runs-on: ubuntu-latest
51+
needs: [check_code]
52+
outputs:
53+
upload_url: ${{ steps.create_draft.outputs.upload_url }}
54+
steps:
55+
- uses: actions/checkout@v2
56+
57+
- name: Configure Git
58+
run: |
59+
git config --global user.email "actions@github.com"
60+
git config --global user.name "GitHub Actions"
61+
62+
- name: Un-SNAP
63+
run: mvn -B versions:set -DremoveSnapshot -DgenerateBackupPoms=false
64+
65+
- name: Get version
66+
id: version
67+
run: |
68+
echo "::set-output name=release::$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)"
69+
70+
- name: Commit and Push
71+
run: |
72+
git add -A
73+
git commit -m "Release ${{ steps.version.outputs.release }}"
74+
git push origin
75+
git tag v${{ steps.version.outputs.release }}
76+
git push origin --tags
77+
78+
- name: Create Release
79+
id: create_release
80+
uses: actions/create-release@v1
81+
env:
82+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
83+
with:
84+
tag_name: v${{ steps.version.outputs.release }}
85+
release_name: v${{ steps.version.outputs.release }}
86+
commitish: master
87+
body: |
88+
## Installation
89+
Add the following lines to your pom:
90+
```XML
91+
<dependency>
92+
<groupId>com.xdev-software</groupId>
93+
<artifactId>xapi-db-mysql-5</artifactId>
94+
<version>${{ steps.version.outputs.release }}</version>
95+
</dependency>
96+
```
97+
draft: false
98+
prerelease: false
99+
100+
publish_central: # Publish the code to central
101+
runs-on: ubuntu-latest
102+
needs: [prepare_release]
103+
steps:
104+
- uses: actions/checkout@v2
105+
106+
- name: Init Git and pull
107+
run: |
108+
git config --global user.email "actions@github.com"
109+
git config --global user.name "GitHub Actions"
110+
git pull
111+
112+
- name: Set up JDK 8 Apache Maven Central
113+
uses: actions/setup-java@v2
114+
with: # running setup-java again overwrites the settings.xml
115+
distribution: 'zulu'
116+
java-version: '8'
117+
java-package: jdk+fx
118+
server-id: ossrh
119+
server-username: MAVEN_CENTRAL_USERNAME
120+
server-password: MAVEN_CENTRAL_TOKEN
121+
gpg-passphrase: MAVEN_GPG_PASSPHRASE
122+
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
123+
124+
- name: Publish to Apache Maven Central
125+
run: mvn -B deploy -Possrh
126+
env:
127+
MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
128+
MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
129+
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
130+
131+
publish-pages:
132+
name: Publish dependencies and licenses to github pages
133+
runs-on: ubuntu-latest
134+
needs: [prepare_release]
135+
steps:
136+
- uses: actions/checkout@v2
137+
138+
- name: Init Git and pull
139+
run: |
140+
git config --global user.email "actions@github.com"
141+
git config --global user.name "GitHub Actions"
142+
git pull
143+
144+
- name: Set up JDK 8
145+
uses: actions/setup-java@v2
146+
with:
147+
distribution: 'zulu'
148+
java-version: '8'
149+
java-package: jdk+fx
150+
151+
- name: Restore - Maven Cache
152+
uses: actions/cache@v1
153+
with:
154+
path: ~/.m2/repository
155+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
156+
restore-keys: |
157+
${{ runner.os }}-maven-:
158+
159+
- name: Build dependencies/licenses files
160+
run: mvn -B project-info-reports:dependencies
161+
162+
- name: Upload licenses - Upload Artifact
163+
uses: actions/upload-artifact@v2
164+
with:
165+
name: dependencies-licenses
166+
path: target/site
167+
168+
- name: Generate docs/dependencies dir
169+
run: mkdir -p docs/dependencies
170+
171+
- name: Move built files into docs/dependencies
172+
run: mv target/site/* docs/dependencies
173+
174+
- name: Rename dependencies.html to index.html
175+
working-directory: docs/dependencies
176+
run: mv dependencies.html index.html
177+
178+
- name: Copy Readme into docs (as index.md)
179+
run: cp README.md docs/index.md
180+
181+
- name: Configure Pages
182+
working-directory: docs
183+
run: |-
184+
echo "theme: jekyll-theme-tactile" > _config.yml
185+
186+
- name: Deploy to Github pages
187+
uses: peaceiris/actions-gh-pages@v3
188+
with:
189+
github_token: ${{ secrets.GITHUB_TOKEN }}
190+
publish_dir: ./docs
191+
enable_jekyll: true
192+
193+
after_release:
194+
runs-on: ubuntu-latest
195+
needs: [publish_central]
196+
steps:
197+
- uses: actions/checkout@v2
198+
199+
- name: Init Git and pull
200+
run: |
201+
git config --global user.email "actions@github.com"
202+
git config --global user.name "GitHub Actions"
203+
git pull
204+
205+
- name: Inc Version and SNAP root
206+
run: mvn -B build-helper:parse-version versions:set -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.nextIncrementalVersion} -DgenerateBackupPoms=false -DnextSnapshot=true
207+
208+
- name: Git Commit and Push
209+
run: |
210+
git add -A
211+
git commit -m "Preparing for next development iteration"
212+
git push origin
213+
214+
- name: pull-request
215+
uses: repo-sync/pull-request@v2
216+
with:
217+
github_token: ${{ secrets.GITHUB_TOKEN }}
218+
destination_branch: "develop"
219+
pr_title: "Sync back"
220+
pr_body: "An automated PR to sync changes back"

.github/workflows/test-deploy.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Test Deployment CI
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
publish_central: # Publish the code to central
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v2
11+
12+
- name: Set up JDK 8 Apache Maven Central
13+
uses: actions/setup-java@v2
14+
with: # running setup-java again overwrites the settings.xml
15+
distribution: 'zulu'
16+
java-version: '8'
17+
java-package: jdk+fx
18+
server-id: ossrh
19+
server-username: MAVEN_CENTRAL_USERNAME
20+
server-password: MAVEN_CENTRAL_TOKEN
21+
gpg-passphrase: MAVEN_GPG_PASSPHRASE
22+
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
23+
24+
- name: Publish to Apache Maven Central
25+
run: mvn -B deploy -Possrh
26+
env:
27+
MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
28+
MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
29+
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}

0 commit comments

Comments
 (0)