Skip to content

Testing GH actions with a release version #5

Testing GH actions with a release version

Testing GH actions with a release version #5

name: Publish Jars Snapshots
on:
push:
branches: [ 146-Migrate-maven-repository ]
paths:
- 'core/src/main/**'
- 'main/src/main/**'
- 'model/src/main/**'
- 'build.gradle'
- '.github/workflows/publish_snapshots.yml'
workflow_dispatch:
env:
java_version: '17'
java_distribution: 'zulu'
jobs:
publish-snapshots:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
# We need to download all tags so that the axion-release-plugin
# can resolve the most recent version tag.
fetch-depth: 0
- name: Set up JDK ${{ env.java_version }}-${{ env.java_distribution }}
uses: actions/setup-java@v3
with:
java-version: ${{ env.java_version }}
distribution: ${{ env.java_distribution }}
- name: Load secrets from 1Password
id: onepw_secrets
uses: ./.github/actions/extract-1password-secret
with:
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }} # This is required to connect to the vault in our 1Password account.
VARIABLES_TO_EXTRACT: 'MAVEN_GPG_PASSPHRASE, MAVEN_GPG_PRIVATE_KEY, MAVEN_CENTRAL_PORTAL_TOKEN_USERNAME, MAVEN_CENTRAL_PORTAL_TOKEN_PASSWORD'
ONE_PASSWORD_SECRET_REFERENCES: ${{ vars.ONE_PASSWORD_SECRET_REFERENCES }}
- name: Build and Publish to the snapshot repository
run: |
# Publishing to the snapshot repository will fail if the current commit has a version tag.
# Which in effect makes it a release.
# See https://central.sonatype.com/service/rest/repository/browse/maven-snapshots/org/mobilitydata/gtfs-validator/
# for the snapshot repository.
./gradlew publishToSnapshotRepository