Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 50 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,22 @@
description: "version number for this release."
required: true

permissions: {}

jobs:
build-maven-jars:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- name: Set up JDK
uses: actions/setup-java@b843ebf9b913146b38da2eaa7aeddf76074ae1ad # v6.1.0
uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5.7.0
with:
java-version: 21
distribution: "zulu"
Expand All @@ -59,15 +62,54 @@
env:
GITHUB_EVENT_INPUTS_VERSION: ${{ github.event.inputs.version }}

- name: Deploy to Sonatype staging
- name: Authenticate to Google Cloud
uses: google-github-actions/auth@7c6bc770dae815cd3e89ee6cdf493a5fab2cc093 # v3.0.0
with:
workload_identity_provider: "projects/305452601764/locations/global/workloadIdentityPools/builders/providers/github"

- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@aa5489c8933f4cc7a4f7d45035b3b1440c9c10db # v3.0.1

- name: Clean up previous staging attempt for this version (if any)
env:
VERSION: ${{ github.event.inputs.version }}
run: |
set -euo pipefail
while IFS= read -r pkg; do
pkg_name="${pkg##*/}"
[ -n "${pkg_name}" ] || continue
if gcloud artifacts versions describe "${VERSION}" \
--package="${pkg_name}" \
--project="oss-exit-gate-prod" \
--location="us" \
--repository="google-java-fmt--mavencentral" >/dev/null 2>&1; then
gcloud artifacts versions delete "${VERSION}" \
--package="${pkg_name}" \
--project="oss-exit-gate-prod" \
--location="us" \
--repository="google-java-fmt--mavencentral" \
--quiet
fi
done < <(gcloud artifacts packages list \
--project="oss-exit-gate-prod" \
--location="us" \
--repository="google-java-fmt--mavencentral" \
--format="value(name)" 2>/dev/null || true)

- name: Deploy to OSS Exit Gate staging and trigger release
env:
CI_DEPLOY_USERNAME: ${{ secrets.CI_DEPLOY_USERNAME }}
CI_DEPLOY_PASSWORD: ${{ secrets.CI_DEPLOY_PASSWORD }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
run: mvn --no-transfer-progress -pl '!eclipse_plugin' -P sonatype-oss-release clean deploy -Dgpg.passphrase="${{ secrets.GPG_PASSPHRASE }}"
RUN_ID: ${{ github.run_id }}
RUN_ATTEMPT: ${{ github.run_attempt }}
run: |
mvn --no-transfer-progress -pl '!eclipse_plugin' -P sonatype-oss-release,oss-exit-gate clean deploy -Dgpg.passphrase="${GPG_PASSPHRASE}"
echo '{"publish_all": true}' > manifest.json
gcloud storage cp manifest.json "gs://oss-exit-gate-prod-projects-bucket/google-java-fmt/mavencentral/manifests/manifest-${RUN_ID}-${RUN_ATTEMPT}.json"

- name: Build Eclipse plugin
run: mvn --no-transfer-progress -pl 'eclipse_plugin' verify gpg:sign -DskipTests=true -Dgpg.passphrase="${{ secrets.GPG_PASSPHRASE }}"
env:
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
run: mvn --no-transfer-progress -pl 'eclipse_plugin' verify gpg:sign -DskipTests=true -Dgpg.passphrase="${GPG_PASSPHRASE}"

- name: Push tag
run: |
Expand All @@ -76,7 +118,7 @@
GITHUB_EVENT_INPUTS_VERSION: ${{ github.event.inputs.version }}

- name: Add Artifacts to Release Entry
uses: softprops/action-gh-release@efb35369e0ad2afab669f228072c1b0d510eae64 # v3.0.3
uses: softprops/action-gh-release@3d0d9888cb7fd7b750713d6e236d1fcb99157228 # v3.0.2

Check notice on line 121 in .github/workflows/release.yml

View workflow job for this annotation

GitHub Actions / zizmor-output

superfluous-actions

release.yml:121: action functionality is already included by the runner: use `gh release` in a script step
with:
draft: true
name: ${{ github.event.input.version }}
Expand Down Expand Up @@ -111,7 +153,7 @@
with:
persist-credentials: false
- name: "Set up GraalVM"
uses: graalvm/setup-graalvm@27b360dbb857524eaf0b4c4cef364d38e5b4f173 # v1.6.7
uses: graalvm/setup-graalvm@5298d94fb55a4f185c602eeac5de1b553882abe2 # v1.6.4
with:
java-version: "25"
distribution: "graalvm-community"
Expand Down
44 changes: 44 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,13 @@
</dependencyManagement>

<build>
<extensions>
<extension>
<groupId>com.google.cloud.artifactregistry</groupId>
<artifactId>artifactregistry-maven-wagon</artifactId>
<version>2.2.5</version>
</extension>
</extensions>
<pluginManagement>
<plugins>
<plugin>
Expand Down Expand Up @@ -373,5 +380,42 @@
<module>eclipse_plugin</module>
</modules>
</profile>
<!-- OSS Exit Gate publishing profile (mvn deploy -P sonatype-oss-release,oss-exit-gate) -->
<profile>
<id>oss-exit-gate</id>
<build>
<plugins>
<plugin>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
<configuration>
<skipPublishing>true</skipPublishing>
</configuration>
</plugin>
<!-- central-publishing-maven-plugin (extensions=true) disables default-deploy;
this execution restores deploy behaviour when skipPublishing=true. -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>3.1.3</version>
<executions>
<execution>
<id>oss-exit-gate-deploy</id>
<phase>deploy</phase>
<goals>
<goal>deploy</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<distributionManagement>
<repository>
<id>oss-exit-gate</id>
<url>artifactregistry://us-maven.pkg.dev/oss-exit-gate-prod/google-java-fmt--mavencentral</url>
</repository>
</distributionManagement>
</profile>
</profiles>
</project>
Loading