Run maven snapshot publication weekly as well as on PR merge (#847) #370
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish snapshots to maven | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 0 * * 0' # Run weekly on Sundays at midnight UTC | |
push: | |
branches: | |
- main | |
- '[0-9]+.[0-9]+' | |
- '[0-9]+.x' | |
jobs: | |
build-and-publish-snapshots: | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: write | |
steps: | |
- uses: actions/checkout@v5 | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v5 | |
with: | |
distribution: temurin # Temurin is a distribution of adoptium | |
java-version: 21 | |
- name: Load secret | |
uses: 1password/load-secrets-action@v3 | |
with: | |
# Export loaded secrets as environment variables | |
export-env: true | |
env: | |
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }} | |
SONATYPE_USERNAME: op://opensearch-infra-secrets/maven-central-portal-credentials/username | |
SONATYPE_PASSWORD: op://opensearch-infra-secrets/maven-central-portal-credentials/password | |
- name: Publish snapshots to maven | |
run: | | |
# For JS-SPI jar | |
./gradlew publishShadowPublicationToSnapshotsRepository | |
# For JS jar | |
./gradlew publishNebulaPublicationToSnapshotsRepository | |
# For JS plugin zip | |
./gradlew publishPluginZipPublicationToSnapshotsRepository |