Skip to content

bcgov-nr/action-gwa-publish

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Issues Pull Requests MIT License Lifecycle

API Services Portal configuration

This action publishes an api through the BC Government Gateway gateway.

This is useful in CI/CD pipelines where you need to access a secret, get a vault token or anything vault related.

This tool is currently based on the existing documentation provided by 1team.

Usage

- uses: bcgov-nr/action-gwa-publish@main
  with:
    ### Required
  
    # Namespace of the API
    namespace: The namespace of you routes collection
    
    # API Client ID
    client_id: Namespace's Client ID from API Services Portal
    
    # API Client Secret
    client_secret: Namespace's Client Secret from API Services Portal
    
    # API Configuration File
    file: Template file (e.g. backend/service.gwa.yml)


    ### Typical / recommended

    # Use production environment
    # By default, set as true
    production: Set the environment to be used as the production environment

    

Example

Publish a test environment API for the end-user.

Create or modify a GitHub workflow, like below. E.g. ./github/workflows/pr-open.yml

name: Pull Request

on:
  pull_request:

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

jobs:
  builds:
    permissions:
      packages: write
    runs-on: ubuntu-22.04
    steps:
      - uses: actions/checkout@v3
      - name: Publish API
        uses: bcgov-nr/action-gwa-publish@main
        with:
          namespace: api-namespace
          client_id: ${{ secrets.GWA_CLIENT_ID }}
          client_secret: ${{ secrets.GWA_CLIENT_SECRET }}    
          file: backend/service.gwa.yml

Example, Matrix

Read from multiple folders and publish each one.

Create or modify a GitHub workflow, like below. E.g. ./github/workflows/pr-open.yml

name: Pull Request

on:
  pull_request:

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

jobs:
  builds:
    permissions:
      packages: write
    runs-on: ubuntu-22.04
    strategy:
      matrix:
        name: [api1, api2]
        include:
          - name: api1
            file: api1/api.gwa.yml          
          - name: api2
            file: api2/service.yaml
    steps:
      - uses: actions/checkout@v3
      - name: Publish API
        uses: bcgov-nr/action-gwa-publish@main
        with:
          namespace: api-namespace
          client_id: ${{ secrets.GWA_CLIENT_ID }}
          client_secret: ${{ secrets.GWA_CLIENT_SECRET }}    
          file: ${{ matrix.file }}