Skip to content

Commit

Permalink
Merge pull request #4 from rohit-walia/task/remove-snapshot-from-version
Browse files Browse the repository at this point in the history
update workflow actions for gpg signing
  • Loading branch information
rohit-walia authored Mar 24, 2024
2 parents d647384 + b8828a5 commit d624483
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 39 deletions.
9 changes: 5 additions & 4 deletions .github/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
<profiles>
<profile>
<id>github</id>
<properties>
<gpg.executable>gpg</gpg.executable>
<gpg.passphrase>${env.GPG_PASSPHRASE}</gpg.passphrase>
</properties>
<repositories>
<repository>
<id>central</id>
Expand All @@ -17,9 +21,6 @@
<repository>
<id>github</id>
<url>https://maven.pkg.github.com/rohit-walia/*</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</profile>
Expand All @@ -29,7 +30,7 @@
<server>
<id>github</id>
<username>${env.USER_NAME}</username>
<password>${env.ACCESS_TOKEN}</password>
<password>${env.PAT_TOKEN}</password>
</server>
</servers>
</settings>
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,18 @@
# This workflow uses actions that are not certified by GitHub. They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support documentation.

name: CI/CD Pipeline - Build and Test
name: CI/CD Pipeline - Build, Test and Upload Artifacts

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

permissions:
checks: write

jobs:
build:
name: Build, Test and Package
# Using GitHub hosted Linux runner w/ 2CPUs, 7GB RAM, 14GB SSD
runs-on: ubuntu-latest
build_and_test:
name: Build and Test
runs-on: ubuntu-latest # Using GitHub hosted Linux runner w/ 2CPUs, 7GB RAM, 14GB SSD

steps:
- name: Checkout
Expand All @@ -32,14 +28,13 @@ jobs:
distribution: 'zulu'
cache: maven
settings-path: ${{ github.workspace }}/.github
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}

- name: Build, Test and Package
run: mvn -B package -P FullBuild
- name: Build and Test
run: mvn $MVN_CLI_ARGS test -P FullBuild
env:
USER_NAME: ${{ secrets.USER_NAME }}
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PAT_TOKEN: ${{ secrets.PAT_TOKEN }}
MVN_CLI_ARGS: -s ${{ github.workspace }}/.github/settings.xml --batch-mode

- name: Publish Test Report
uses: mikepenz/action-junit-report@v4.1.0
Expand All @@ -48,8 +43,29 @@ jobs:
report_paths: 'core/target/surefire-reports/TEST-*.xml'
fail_on_failure: true

- name: Upload artifacts
uses: actions/upload-artifact@v4
upload_artifacts:
name: Package and Upload Artifacts
if: github.event.pull_request.merged
runs-on: ubuntu-latest # Using GitHub hosted Linux runner w/ 2CPUs, 7GB RAM, 14GB SSD

permissions:
checks: write

steps:
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
name: jar artifacts
path: core/target/*.jar
java-version: '17'
distribution: 'zulu'
cache: maven
settings-path: ${{ github.workspace }}/.github
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}

- name: Package and Upload Artifacts
run: mvn $MVN_CLI_ARGS package -P FastBuild
env:
USER_NAME: ${{ secrets.USER_NAME }}
PAT_TOKEN: ${{ secrets.PAT_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # for GitHub APIs
MVN_CLI_ARGS: -s ${{ github.workspace }}/.github/settings.xml --batch-mode

Original file line number Diff line number Diff line change
Expand Up @@ -4,42 +4,40 @@
# This workflow uses actions that are not certified by GitHub. They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support documentation.

name: CI/CD Pipeline - Publish
name: CI/CD Pipeline - Publish and Deploy

on:
release:
types: [created]

jobs:
publish:
name: Package and Deploy
runs-on: ubuntu-latest
publish_and_deploy:
name: Build, Test, Package and Deploy
runs-on: ubuntu-latest # Using GitHub hosted Linux runner w/ 2CPUs, 7GB RAM, 14GB SSD

permissions:
contents: read
packages: write

steps:
- uses: actions/checkout@v4
- name: Checkout
uses: actions/checkout@v4

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'zulu'
cache: maven
settings-path: ${{ github.workspace }}/.github
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}

- name: Build, Test and Package
run: mvn -B package -pl core -am -P FullBuild
env:
USER_NAME: ${{ secrets.USER_NAME }}
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
overwrite-settings: false
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} # import GPG private key

- name: Deploy to GitHub Packages
run: mvn -B deploy -pl core -am -P FastBuild
run: mvn $MAVEN_CLI_OPTS deploy -P FullBuild
env:
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} # for gpg signing
USER_NAME: ${{ secrets.USER_NAME }}
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PAT_TOKEN: ${{ secrets.PAT_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # for GitHub APIs
MAVEN_CLI_OPTS: -s ${{ github.workspace }}/.github/settings.xml --batch-mode
2 changes: 1 addition & 1 deletion core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>org.jacksonhelper</groupId>
<artifactId>jackson-helper</artifactId>
<version>1.0.0</version>
<version>1.0.0-SNAPSHOT</version>
</parent>

<artifactId>core</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>org.jacksonhelper</groupId>
<artifactId>jackson-helper</artifactId>
<version>1.0.0</version>
<version>1.0.0-SNAPSHOT</version>
<packaging>pom</packaging>

<modules>
Expand Down

0 comments on commit d624483

Please sign in to comment.