From 7dde93fdc93bb86ee86f38ca25a512ac86502dfb Mon Sep 17 00:00:00 2001 From: Michael7371 <40476797+Michael7371@users.noreply.github.com> Date: Mon, 10 Jun 2024 12:47:14 -0600 Subject: [PATCH 1/9] test artifact publishing --- .github/workflows/artifact-publish.yml | 33 ++++++++++++++++++++++++++ pom.xml | 9 +++++++ 2 files changed, 42 insertions(+) create mode 100644 .github/workflows/artifact-publish.yml diff --git a/.github/workflows/artifact-publish.yml b/.github/workflows/artifact-publish.yml new file mode 100644 index 0000000..004c6f8 --- /dev/null +++ b/.github/workflows/artifact-publish.yml @@ -0,0 +1,33 @@ +name: Publish Java Package + +on: + # commented out for testing + # release: + # types: [created] + pull_request: + types: + - opened + - synchronize + - reopened + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + java-version: '21' + distribution: 'adopt' + + - name: Build with Maven + run: mvn -B package --file pom.xml + + - name: Publish to GitHub Packages + run: mvn --batch-mode -Dgithub_organization=${{ github.repository_owner }} deploy + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/pom.xml b/pom.xml index d6e0ad1..b43be26 100644 --- a/pom.xml +++ b/pom.xml @@ -10,6 +10,8 @@ 21 21 + + usdot-jpo-ode @@ -101,4 +103,11 @@ + + + github + GitHub Packages + https://github.com/${github_organization}/jpo-s3-deposit + + From 35b7f18019eeccb582fedf3163e7a4fb029b8f93 Mon Sep 17 00:00:00 2001 From: Michael7371 <40476797+Michael7371@users.noreply.github.com> Date: Mon, 10 Jun 2024 12:49:43 -0600 Subject: [PATCH 2/9] fix artifact endpoint --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index b43be26..c29687b 100644 --- a/pom.xml +++ b/pom.xml @@ -107,7 +107,7 @@ github GitHub Packages - https://github.com/${github_organization}/jpo-s3-deposit + https://maven.pkg.github.com/${github_organization}/jpo-s3-deposit From 5460c519735e90d9d9917501cb9d780a838d0e6b Mon Sep 17 00:00:00 2001 From: Michael7371 <40476797+Michael7371@users.noreply.github.com> Date: Mon, 10 Jun 2024 12:56:06 -0600 Subject: [PATCH 3/9] update trigger to only run on release --- .github/workflows/artifact-publish.yml | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/.github/workflows/artifact-publish.yml b/.github/workflows/artifact-publish.yml index 004c6f8..cb6ae1e 100644 --- a/.github/workflows/artifact-publish.yml +++ b/.github/workflows/artifact-publish.yml @@ -1,14 +1,8 @@ name: Publish Java Package on: - # commented out for testing - # release: - # types: [created] - pull_request: - types: - - opened - - synchronize - - reopened + release: + types: [created] jobs: build: From 3462850072bd733dbdc1ed9cf72b168da273c046 Mon Sep 17 00:00:00 2001 From: Michael7371 <40476797+Michael7371@users.noreply.github.com> Date: Wed, 12 Jun 2024 13:54:18 -0600 Subject: [PATCH 4/9] testing -DremoveSnapshot task for artifact publishing github action --- .github/workflows/artifact-publish.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/artifact-publish.yml b/.github/workflows/artifact-publish.yml index cb6ae1e..d1b90be 100644 --- a/.github/workflows/artifact-publish.yml +++ b/.github/workflows/artifact-publish.yml @@ -1,8 +1,13 @@ name: Publish Java Package on: - release: - types: [created] + # release: + # types: [created] + pull_request: + types: + - opened + - synchronize + - reopened jobs: build: @@ -17,6 +22,9 @@ jobs: with: java-version: '21' distribution: 'adopt' + + - name: Remove snapshot from version + run: mvn versions:set -DremoveSnapshot - name: Build with Maven run: mvn -B package --file pom.xml From ebcc32dbe7f949d6b264c44a76317346599f7df5 Mon Sep 17 00:00:00 2001 From: Michael7371 <40476797+Michael7371@users.noreply.github.com> Date: Wed, 12 Jun 2024 13:56:58 -0600 Subject: [PATCH 5/9] updating artifact-publish github action to be triggered on release creation after testing --- .github/workflows/artifact-publish.yml | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/.github/workflows/artifact-publish.yml b/.github/workflows/artifact-publish.yml index d1b90be..cb9e80d 100644 --- a/.github/workflows/artifact-publish.yml +++ b/.github/workflows/artifact-publish.yml @@ -1,13 +1,8 @@ name: Publish Java Package on: - # release: - # types: [created] - pull_request: - types: - - opened - - synchronize - - reopened + release: + types: [created] jobs: build: From 465545c77ab562ca1313802d6b94c34953c12a79 Mon Sep 17 00:00:00 2001 From: Michael7371 <40476797+Michael7371@users.noreply.github.com> Date: Wed, 12 Jun 2024 15:36:47 -0600 Subject: [PATCH 6/9] testing snapshot publishing --- .../workflows/artifact-publish-dev-caller.yml | 16 ++++++++++++++++ .../workflows/artifact-publish-tag-caller.yml | 14 ++++++++++++++ .github/workflows/artifact-publish.yml | 14 +++++++++++--- 3 files changed, 41 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/artifact-publish-dev-caller.yml create mode 100644 .github/workflows/artifact-publish-tag-caller.yml diff --git a/.github/workflows/artifact-publish-dev-caller.yml b/.github/workflows/artifact-publish-dev-caller.yml new file mode 100644 index 0000000..89bd3a3 --- /dev/null +++ b/.github/workflows/artifact-publish-dev-caller.yml @@ -0,0 +1,16 @@ +name: Publish Java Package Snapshot + +on: + push: + branches: + - develop + - dev + - cicd-artifact-publishing + +jobs: + publish-java-package: + uses: ./.github/workflows/artifact-publish.yml + with: + drop-snapshot: false + secrets: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/artifact-publish-tag-caller.yml b/.github/workflows/artifact-publish-tag-caller.yml new file mode 100644 index 0000000..df31341 --- /dev/null +++ b/.github/workflows/artifact-publish-tag-caller.yml @@ -0,0 +1,14 @@ +name: Publish Java Package Tag + +on: + push: + tags: + - "*" + +jobs: + publish-java-package: + uses: ./.github/workflows/artifact-publish.yml + with: + drop-snapshot: true + secrets: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/artifact-publish.yml b/.github/workflows/artifact-publish.yml index cb9e80d..0b0160d 100644 --- a/.github/workflows/artifact-publish.yml +++ b/.github/workflows/artifact-publish.yml @@ -1,8 +1,15 @@ name: Publish Java Package on: - release: - types: [created] + workflow_call: + inputs: + drop-snapshot: + description: 'Drop snapshot from version' + required: true + type: boolean + secrets: + GITHUB_TOKEN: + required: true jobs: build: @@ -17,8 +24,9 @@ jobs: with: java-version: '21' distribution: 'adopt' - + - name: Remove snapshot from version + if: ${{ github.event.inputs.drop-snapshot == 'true' }} run: mvn versions:set -DremoveSnapshot - name: Build with Maven From 18ab77cb5a04f91538922b96d9f47edb442bbfd9 Mon Sep 17 00:00:00 2001 From: Michael7371 <40476797+Michael7371@users.noreply.github.com> Date: Wed, 12 Jun 2024 15:42:29 -0600 Subject: [PATCH 7/9] Removing GitHub token secret reference in workflow --- .github/workflows/artifact-publish-dev-caller.yml | 4 +--- .github/workflows/artifact-publish-tag-caller.yml | 4 +--- .github/workflows/artifact-publish.yml | 3 --- 3 files changed, 2 insertions(+), 9 deletions(-) diff --git a/.github/workflows/artifact-publish-dev-caller.yml b/.github/workflows/artifact-publish-dev-caller.yml index 89bd3a3..858d6c7 100644 --- a/.github/workflows/artifact-publish-dev-caller.yml +++ b/.github/workflows/artifact-publish-dev-caller.yml @@ -11,6 +11,4 @@ jobs: publish-java-package: uses: ./.github/workflows/artifact-publish.yml with: - drop-snapshot: false - secrets: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + drop-snapshot: false \ No newline at end of file diff --git a/.github/workflows/artifact-publish-tag-caller.yml b/.github/workflows/artifact-publish-tag-caller.yml index df31341..bf4ed53 100644 --- a/.github/workflows/artifact-publish-tag-caller.yml +++ b/.github/workflows/artifact-publish-tag-caller.yml @@ -9,6 +9,4 @@ jobs: publish-java-package: uses: ./.github/workflows/artifact-publish.yml with: - drop-snapshot: true - secrets: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + drop-snapshot: true \ No newline at end of file diff --git a/.github/workflows/artifact-publish.yml b/.github/workflows/artifact-publish.yml index 0b0160d..ee6e895 100644 --- a/.github/workflows/artifact-publish.yml +++ b/.github/workflows/artifact-publish.yml @@ -7,9 +7,6 @@ on: description: 'Drop snapshot from version' required: true type: boolean - secrets: - GITHUB_TOKEN: - required: true jobs: build: From 50c31e32bae60948350102e568a25643363f79d1 Mon Sep 17 00:00:00 2001 From: Michael7371 <40476797+Michael7371@users.noreply.github.com> Date: Wed, 12 Jun 2024 16:04:13 -0600 Subject: [PATCH 8/9] Removing dev trigger as tags are immutable in GitHub's Maven Registry. --- .github/workflows/artifact-publish-dev-caller.yml | 14 -------------- .github/workflows/artifact-publish-tag-caller.yml | 12 ------------ .github/workflows/artifact-publish.yml | 10 +++------- 3 files changed, 3 insertions(+), 33 deletions(-) delete mode 100644 .github/workflows/artifact-publish-dev-caller.yml delete mode 100644 .github/workflows/artifact-publish-tag-caller.yml diff --git a/.github/workflows/artifact-publish-dev-caller.yml b/.github/workflows/artifact-publish-dev-caller.yml deleted file mode 100644 index 858d6c7..0000000 --- a/.github/workflows/artifact-publish-dev-caller.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: Publish Java Package Snapshot - -on: - push: - branches: - - develop - - dev - - cicd-artifact-publishing - -jobs: - publish-java-package: - uses: ./.github/workflows/artifact-publish.yml - with: - drop-snapshot: false \ No newline at end of file diff --git a/.github/workflows/artifact-publish-tag-caller.yml b/.github/workflows/artifact-publish-tag-caller.yml deleted file mode 100644 index bf4ed53..0000000 --- a/.github/workflows/artifact-publish-tag-caller.yml +++ /dev/null @@ -1,12 +0,0 @@ -name: Publish Java Package Tag - -on: - push: - tags: - - "*" - -jobs: - publish-java-package: - uses: ./.github/workflows/artifact-publish.yml - with: - drop-snapshot: true \ No newline at end of file diff --git a/.github/workflows/artifact-publish.yml b/.github/workflows/artifact-publish.yml index ee6e895..d77c5bb 100644 --- a/.github/workflows/artifact-publish.yml +++ b/.github/workflows/artifact-publish.yml @@ -1,12 +1,9 @@ name: Publish Java Package on: - workflow_call: - inputs: - drop-snapshot: - description: 'Drop snapshot from version' - required: true - type: boolean + push: + tags: + - "*" jobs: build: @@ -23,7 +20,6 @@ jobs: distribution: 'adopt' - name: Remove snapshot from version - if: ${{ github.event.inputs.drop-snapshot == 'true' }} run: mvn versions:set -DremoveSnapshot - name: Build with Maven From cfcef3cb0eae87b5ec0105b6cfe42224de9262d8 Mon Sep 17 00:00:00 2001 From: Michael7371 <40476797+Michael7371@users.noreply.github.com> Date: Thu, 13 Jun 2024 09:30:24 -0600 Subject: [PATCH 9/9] updating workflow to only trigger on release tags --- .github/workflows/artifact-publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/artifact-publish.yml b/.github/workflows/artifact-publish.yml index d77c5bb..c09e1fc 100644 --- a/.github/workflows/artifact-publish.yml +++ b/.github/workflows/artifact-publish.yml @@ -3,7 +3,7 @@ name: Publish Java Package on: push: tags: - - "*" + - 'jpo-s3-deposit-*' jobs: build: