Skip to content

Commit 7cf0c37

Browse files
committed
Migrate workflows to connectorio templates.
Signed-off-by: Łukasz Dywicki <luke@code-house.org>
1 parent cf47952 commit 7cf0c37

File tree

6 files changed

+111
-142
lines changed

6 files changed

+111
-142
lines changed

.github/workflows/maven.yml

Lines changed: 0 additions & 74 deletions
This file was deleted.

.github/workflows/pr.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Build pull request
2+
3+
on:
4+
pull_request:
5+
branches: [ "master" ]
6+
7+
jobs:
8+
build:
9+
permissions:
10+
checks: write
11+
contents: read
12+
uses: 'connectorio/gh-actions-shared/.github/workflows/maven.yml@master'
13+
secrets:
14+
CI_DEPLOY_USERNAME: ${{ secrets.CI_DEPLOY_USERNAME }}
15+
CI_DEPLOY_PASSWORD: ${{ secrets.CI_DEPLOY_PASSWORD }}
16+
with:
17+
openhab: false
18+
server_id: sonatype-nexus-snapshots
19+
additional_profiles: apache,connectorio
20+
deploy: true
21+
skip_test_publish: true

.github/workflows/push.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Build pushed commit
2+
3+
on:
4+
push:
5+
branches: [ "master" ]
6+
7+
jobs:
8+
build:
9+
#if: ${{ true }}
10+
permissions:
11+
checks: write
12+
contents: read
13+
uses: 'connectorio/gh-actions-shared/.github/workflows/maven.yml@master'
14+
secrets:
15+
CI_DEPLOY_USERNAME: ${{ secrets.CI_DEPLOY_USERNAME }}
16+
CI_DEPLOY_PASSWORD: ${{ secrets.CI_DEPLOY_PASSWORD }}
17+
with:
18+
openhab: false
19+
server_id: sonatype-nexus-snapshots
20+
additional_profiles: apache,connectorio
21+
deploy: true
22+
skip_test_publish: true

.github/workflows/release.yml

Lines changed: 30 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,39 @@
1-
name: Maven release
1+
name: Release artifacts
22

33
on:
44
workflow_dispatch:
55
inputs:
6-
releaseVersion:
7-
description: "Release version."
6+
release_version:
7+
description: 'The version to be released from actual HEAD revision'
8+
required: false
9+
default: 'X.Y.Z'
10+
development_version:
11+
description: 'Version to be set as next, after release is made (appends commit to HEAD revision)'
12+
required: false
13+
default: 'X.Y.Z-SNAPSHOT'
14+
perform_version:
15+
description: 'Tag which should be used to perform release and publish its artifacts'
16+
required: false
17+
dry_run:
18+
description: 'Should execution abstain from mutating repository/remote state?'
819
required: true
9-
default: "X.Y.Z"
10-
developmentVersion:
11-
description: "Version to which working copy should be set after release."
12-
required: true
13-
default: "X.Y.Z-SNAPSHOT"
14-
dryRun:
15-
description: "Should release be done in dry-run mode."
16-
required: true
17-
default: "true"
20+
default: 'true'
1821

1922
jobs:
20-
release:
21-
runs-on: ubuntu-latest
23+
build:
2224
permissions:
2325
contents: write
24-
steps:
25-
- uses: actions/checkout@v3
26-
- name: Setup git
27-
run: |
28-
git config user.email "ci@connectorio.com"
29-
git config user.name "ConnectorIO Bot"
30-
git config --global url."https://${BUILD_USER}:${BUILD_TOKEN}@github.com/".insteadOf "git@github.com:"
31-
env:
32-
BUILD_USER: x-access-token
33-
BUILD_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34-
- uses: actions/setup-java@v3
35-
with:
36-
distribution: 'temurin'
37-
java-version: '11'
38-
server-id: sonatype-nexus-staging
39-
server-username: CI_RELEASE_USERNAME
40-
server-password: CI_RELEASE_PASSWORD
41-
gpg-passphrase: GPG_PASSPHRASE
42-
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
43-
- name: Cache local Maven repository
44-
uses: actions/cache@v3
45-
with:
46-
path: ~/.m2/repository
47-
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
48-
restore-keys: |
49-
${{ runner.os }}-maven-
50-
- name: Dump env
51-
run: >-
52-
env && cat ~/.m2/settings.xml
53-
env:
54-
CI_RELEASE_USERNAME: ${{ secrets.CI_RELEASE_USERNAME }}
55-
CI_RELEASE_PASSWORD: ${{ secrets.CI_RELEASE_PASSWORD }}
56-
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
57-
- name: Maven Prepare Release
58-
run: >-
59-
mvn -B
60-
release:prepare -DpreparationProfiles=release,connectorio
61-
-DreleaseVersion=${{ inputs.releaseVersion }}
62-
-DdevelopmentVersion=${{ inputs.developmentVersion }}
63-
-DdryRun=${{ inputs.dryRun }}
64-
- name: Maven Perform Release
65-
if: success()
66-
run: >-
67-
mvn -B
68-
release:perform -DreleaseProfiles=release,connectorio
69-
env:
70-
CI_RELEASE_USERNAME: ${{ secrets.CI_RELEASE_USERNAME }}
71-
CI_RELEASE_PASSWORD: ${{ secrets.CI_RELEASE_PASSWORD }}
72-
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
73-
- name: Rollback on failure
74-
if: failure()
75-
run: |
76-
mvn -B release:rollback
77-
echo "You may need to manually delete the git tag, if it was created."
26+
uses: 'connectorio/gh-actions-shared/.github/workflows/release.yml@master'
27+
secrets:
28+
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
29+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
30+
CI_RELEASE_USERNAME: ${{ secrets.CI_RELEASE_USERNAME }}
31+
CI_RELEASE_PASSWORD: ${{ secrets.CI_RELEASE_PASSWORD }}
32+
with:
33+
openhab: false
34+
server_id: 'sonatype-nexus-staging'
35+
additional_profiles: apache,connectorio
36+
release_version: ${{ inputs.release_version }}
37+
development_version: ${{ inputs.development_version }}
38+
perform_version: ${{ inputs.perform_version }}
39+
dry_run: ${{ inputs.dry_run }}

parent/pom.xml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,4 +385,18 @@
385385
</plugins>
386386
</build>
387387

388+
<profiles>
389+
<profile>
390+
<id>apache</id>
391+
392+
<repositories>
393+
<repository>
394+
<id>apache-snapshots</id>
395+
<name>Apache Snapshots</name>
396+
<url>https://repository.apache.org/content/repositories/snapshots/</url>
397+
</repository>
398+
</repositories>
399+
</profile>
400+
</profiles>
401+
388402
</project>

pom.xml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,30 @@
6464
</build>
6565

6666
<profiles>
67+
<profile>
68+
<id>sonatype-oss</id>
69+
70+
<activation>
71+
<property>
72+
<name>cicd</name>
73+
<value>true</value>
74+
</property>
75+
</activation>
76+
77+
<repositories>
78+
<repository>
79+
<id>sonatype</id>
80+
<name>Sonatype OSS snapshots</name>
81+
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
82+
<snapshots>
83+
<enabled>true</enabled>
84+
</snapshots>
85+
<releases>
86+
<enabled>false</enabled>
87+
</releases>
88+
</repository>
89+
</repositories>
90+
</profile>
6791
<profile>
6892
<id>connectorio</id>
6993
<activation>

0 commit comments

Comments
 (0)