Skip to content

GitHub actions

Scott Ganyo edited this page Apr 26, 2023 · 8 revisions

We've create a couple of unpublished GitHub actions to help with GitHub workflow integrations:

  • setup-registry - ensures registry CLI is installed and configured
  • registry-check - runs registry check and emits an appropriate report to the workflow and exit code

Example workflow using a local registry service

    services:
      local-registry:
        image: ghcr.io/apigee/registry-server:main
        env:
          REGISTRY_LOGGING_LEVEL: debug
        ports:
          - 8080:8080
    steps:
    - uses: actions/checkout@v3
    - name: Configure local Registry
      uses: apigee/registry/.github/actions/setup-registry@main
      with:
        name: local
        address: localhost:8080
        insecure: true
        project: test
    - name: Create a project
      run: registry rpc admin create-project --project_id test
    - name: Apply an entity into the registry
      run: registry apply -f some-entity-file.yaml
    - name: Run registry check
      uses: apigee/registry/.github/actions/registry-check@main
      with:
        pattern: projects/test
        error-level: WARNING

Example workflow using a GCP hosted registry

  steps:
    - name: Set up Google Cloud auth
      uses: google-github-actions/auth@v1
      with:
        credentials_json: '${{ secrets.GOOGLE_CREDENTIALS }}'
    - name: Set up the Google Cloud SDK
      uses: google-github-actions/setup-gcloud@v1
      with:
        skip_install: true
    - name: Capture GOOGLE_CLOUD_PROJECT env var
      run: echo "GOOGLE_CLOUD_PROJECT=$GOOGLE_CLOUD_PROJECT" >> $GITHUB_ENV
    - name: Verify the Google Cloud SDK installation
      run: gcloud info
    - uses: apigee/registry/.github/actions/registry-config
      with:
        name: cloud
        project: ${{ env.GOOGLE_CLOUD_PROJECT }}
        address: apigeeregistry.googleapis.com:443
        token-source: gcloud auth print-access-token
        insecure: false
    - name: Apply an entity into the registry
      run: registry apply -f some-entity-file.yaml
    - name: Run registry check
      uses: apigee/registry/.github/actions/registry-check@main
      with:
        pattern: projects/test
        error-level: WARNING

For more details on settings: