Skip to content

Implement spath command with field resolution (#5028) #1

Implement spath command with field resolution (#5028)

Implement spath command with field resolution (#5028) #1

name: Publish grammar files to maven
on:
workflow_dispatch:
push:
branches:
- main
- '[0-9]+.[0-9]+'
- '[0-9]+.x'
paths:
- 'language-grammar/src/main/antlr4/**'
- 'language-grammar/build.gradle'
- '.github/workflows/publish-grammar-files.yml'
- '.github/maven-publish-utils.sh'
- '.github/get-sonatype-credentials.sh'
concurrency:
group: maven-publish-language-grammar
cancel-in-progress: false
env:
COMMIT_MAP_FILENAME: commit-history-language-grammar.json
jobs:
publish-grammar-files:
strategy:
fail-fast: false
if: github.repository == 'opensearch-project/sql'
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
env:
TARGET_REPO_PATH: org/opensearch/language-grammar
steps:
- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 21
- uses: actions/checkout@v3
- name: Load secret
uses: 1password/load-secrets-action@v2
with:
# Export loaded secrets as environment variables
export-env: true
env:
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }}
MAVEN_SNAPSHOTS_S3_REPO: op://opensearch-infra-secrets/maven-snapshots-s3/repo
MAVEN_SNAPSHOTS_S3_ROLE: op://opensearch-infra-secrets/maven-snapshots-s3/role
- name: Export SNAPSHOT_REPO_URL
run: |
snapshot_repo_url=${{ env.MAVEN_SNAPSHOTS_S3_REPO }}
echo "SNAPSHOT_REPO_URL=$snapshot_repo_url" >> $GITHUB_ENV
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v5
with:
role-to-assume: ${{ env.MAVEN_SNAPSHOTS_S3_ROLE }}
aws-region: us-east-1
- name: Set version
id: set_version
run: |
VERSION=$(grep "version = " ./language-grammar/build.gradle | cut -d "'" -f 2)
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
echo "Using version: ${VERSION}"
- name: Set commit ID
id: set_commit
run: |
COMMIT_ID=$(git log -1 --format='%H')
echo "commit_id=${COMMIT_ID}" >> $GITHUB_OUTPUT
echo "Using commit ID: ${COMMIT_ID}"
- uses: actions/checkout@v4
with:
repository: 'opensearch-project/opensearch-build'
path: 'build'
- name: Install required tools
run: sudo apt-get update && sudo apt-get install -y xmlstarlet jq
- name: Publish grammar files
run: |
# Source the utility functions
source ./.github/maven-publish-utils.sh
# Call the main function for grammar files
publish_grammar_files "${{ steps.set_version.outputs.VERSION }}" "${{ steps.set_commit.outputs.commit_id }}"