Move config and status saving to the SDK #4
This file contains 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: Update Processor SDK Version | |
'on': | |
pull_request: | |
types: [labeled, opened, synchronize, reopened, auto_merge_enabled] | |
branches: | |
- main | |
paths: | |
# Be conservative and only run this workflow when the Cargo.toml file changes. | |
# Reason: if SDK version is not updated, no change will be picked up by processors. | |
- aptos-indexer-processors-sdk/Cargo.toml | |
permissions: | |
contents: read | |
id-token: write | |
jobs: | |
update-processor-sdk-version: | |
runs-on: ubuntu-latest | |
# Only run on each PR once an appropriate event occurs | |
if: | | |
( | |
github.event_name == 'push' || | |
contains(github.event.pull_request.labels.*.name, 'indexer-sdk-update') | |
) | |
steps: | |
- id: auth | |
uses: "google-github-actions/auth@v2" | |
with: | |
workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }} | |
service_account: ${{ secrets.GCP_SERVICE_ACCOUNT_EMAIL }} | |
- name: Get Secret Manager Secrets | |
id: secrets | |
uses: 'google-github-actions/get-secretmanager-secrets@v2' | |
with: | |
secrets: |- | |
token:aptos-ci/github-actions-repository-dispatch | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ steps.secrets.outputs.token }} | |
- name: Capture the commit hash | |
id: commit_hash | |
run: | | |
# Echo the commit hash to the output | |
echo "::set-output name=commit_hash::$(echo $GITHUB_SHA)" | |
# Echo the PR branch name to the output | |
echo "::set-output name=branch_name::${{ github.head_ref }}" | |
- name: Setup Rust | |
uses: actions-rust-lang/setup-rust-toolchain@v1 | |
- name: Install toml | |
run: cargo install toml-cli | |
- name: Capture aptos-protos commit hash | |
id: aptos_protos_commit_hash | |
run: | | |
cd aptos-indexer-processors-sdk | |
aptos_protos_commit_hash=$(toml get Cargo.toml workspace.dependencies.aptos-protos.rev) | |
echo "::set-output name=aptos_protos_commit_hash::${aptos_protos_commit_hash}" | |
- name: Dispatch Event to processors Repo | |
uses: peter-evans/[email protected] | |
with: | |
token: ${{ steps.secrets.outputs.token }} | |
repository: 'aptos-labs/aptos-indexer-processors' | |
event-type: 'sdk-dependency-update' | |
client-payload: '{"commit_hash": "${{ github.sha }}", "branch_name": "${{ steps.commit_hash.outputs.branch_name }}", "aptos_protos_commit_hash": ${{ steps.aptos_protos_commit_hash.outputs.aptos_protos_commit_hash }}}' |