pgjdbc/pgjdbc GitHub issues and pull requests (mirror)
help / color / mirror / Atom feedFrom: vlsi (@vlsi) <[email protected]>
To: pgjdbc/pgjdbc <[email protected]>
Subject: [pgjdbc/pgjdbc] PR #3814: chore: attach release artifacts to GitHub Release when releasing a new version
Date: Fri, 19 Sep 2025 07:48:21 +0000
Message-ID: <[email protected]> (raw)
Fixes https://github.com/pgjdbc/pgjdbc/issues/3812
diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml
index b97ea67f3f..f01e9e9722 100644
--- a/.github/workflows/release-drafter.yml
+++ b/.github/workflows/release-drafter.yml
@@ -20,9 +20,6 @@ jobs:
permissions:
# write permission is required to create a github release
contents: write
- env:
- # Publish pre-release files to a draft release
- PUBLISH_SNAPSHOT: true
steps:
# Drafts your next Release notes as Pull Requests are merged into "master"
- name: Get the current version
@@ -53,53 +50,3 @@ jobs:
version: ${{ steps.current_version.outputs.result }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- - name: Checkout sources
- if: ${{ env.PUBLISH_SNAPSHOT == 'true' }}
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- - name: Set up JDK 17
- if: ${{ env.PUBLISH_SNAPSHOT == 'true' }}
- uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0
- with:
- java-version: 17
- distribution: liberica
- - name: Build
- if: ${{ env.PUBLISH_SNAPSHOT == 'true' }}
- uses: burrunan/gradle-cache-action@4b67497abd37a511d6c1dc6299bdd84ff39f7bf5 # v3.0.2
- with:
- job-id: jdk17
- arguments: --scan --no-parallel --no-daemon :postgresql:osgiJar
- - name: Attach files to release
- if: ${{ env.PUBLISH_SNAPSHOT == 'true' }}
- uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9
- env:
- # https://github.com/release-drafter/release-drafter#action-outputs
- RELEASE_ID: ${{ steps.prepare_release.outputs.id }}
- with:
- # language=JavaScript
- script: |
- const fs = require('fs');
- const {RELEASE_ID} = process.env;
- // remove old jar files from the release
- const assets = await github.rest.repos.listReleaseAssets({
- owner: context.repo.owner,
- repo: context.repo.repo,
- release_id: RELEASE_ID
- });
- for (const asset of assets.data) {
- if (asset.name.endsWith('.jar')) {
- await github.rest.repos.deleteReleaseAsset({
- owner: context.repo.owner,
- repo: context.repo.repo,
- asset_id: asset.id
- });
- }
- }
- const globber = await glob.create('pgjdbc/build/libs/postgresql-*-osgi.jar');
- const files = await globber.glob();
- await github.rest.repos.uploadReleaseAsset({
- owner: context.repo.owner,
- repo: context.repo.repo,
- name: files[0].replace(/^(.*build\/libs\/postgresql-)/, "postgresql-").replace("-osgi", ""),
- release_id: RELEASE_ID,
- data: fs.readFileSync(files[0])
- })
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index b5073effce..991209e134 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -130,6 +130,56 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ - name: Attach files to the release
+ uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9
+ env:
+ # https://github.com/release-drafter/release-drafter#action-outputs
+ RELEASE_ID: ${{ steps.publish_release.outputs.id }}
+ VERSION: ${{ steps.release_version.outputs.version }}
+ with:
+ # language=javascript
+ script: |
+ const fs = require('fs');
+ const {RELEASE_ID, VERSION} = process.env;
+ const artifactName = `postgresql-${VERSION}.jar`;
+ const signatureName = `${artifactName}.asc`;
+ const globber = await glob.create(`pgjdbc/build/nmcp/m2/org/postgresql/postgresql/${VERSION}/${artifactName}`);
+ const files = await globber.glob();
+ if (files.length !== 1) {
+ core.setFailed(`Expected exactly one release jar named ${artifactName}, found ${files.length}: ${files.join(', ')}`);
+ return;
+ }
+ const uploadFiles = [[artifactName, files[0]], [signatureName, `${files[0]}.asc`]];
+ for (const [name, path] of uploadFiles) {
+ if (!fs.existsSync(path)) {
+ core.setFailed(`Release artifact ${name} does not exist at ${path}`);
+ return;
+ }
+ }
+ const assets = await github.rest.repos.listReleaseAssets({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ release_id: RELEASE_ID
+ });
+ for (const asset of assets.data) {
+ if (asset.name.endsWith('.jar') || asset.name.endsWith('.jar.asc')) {
+ await github.rest.repos.deleteReleaseAsset({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ asset_id: asset.id
+ });
+ }
+ }
+ for (const [name, path] of uploadFiles) {
+ await github.rest.repos.uploadReleaseAsset({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ name,
+ release_id: RELEASE_ID,
+ data: fs.readFileSync(path)
+ });
+ }
+
- name: Compute the next patch version
id: next_version
env:
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: github://pgjdbc/pgjdbc
Cc: [email protected], [email protected]
Subject: Re: [pgjdbc/pgjdbc] PR #3814: chore: attach release artifacts to GitHub Release when releasing a new version
In-Reply-To: <<[email protected]>>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox