Skip to content

chore: [Hub Bot] Refresh metadata 2024-11-25 #2532

chore: [Hub Bot] Refresh metadata 2024-11-25

chore: [Hub Bot] Refresh metadata 2024-11-25 #2532

Workflow file for this run

name: Build and publish Meltano Hub API
on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:
inputs:
hub-url:
description: The base URL of the Meltano Hub site
required: true
default: 'https://hub.meltano.com'
api-url:
description: The base URL of the Hub API
required: true
jobs:
build:
runs-on: ubuntu-latest
environment: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && 'production' || 'preview' }}
if: ${{ !github.event.pull_request.head.repo.fork }}
steps:
- uses: actions/[email protected]
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install Poetry
run: |
pip install --upgrade pip poetry
pip --version
poetry --version
- name: Install dependencies
run: |
poetry install
- name: Set preview variables
if: github.event_name == 'pull_request'
run: |
echo "HUB_URL=https://deploy-preview-${{ github.event.number }}--meltano-hub.netlify.app" >> $GITHUB_ENV
- name: Set production variables
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: |
echo "HUB_URL=https://hub.meltano.com" >> $GITHUB_ENV
- name: Set custom variables
if: github.event_name == 'workflow_dispatch'
run: |
echo "HUB_URL=${{ github.event.inputs.hub-url }}" >> $GITHUB_ENV
- name: Build
env:
API_URL: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.api-url || secrets.HUB_API_URL }}
run: >
poetry run python utility_scripts/api/make_files.py
-o _hub_api
--hub-url ${{ env.HUB_URL }}
--api-url ${{ env.API_URL }}
- name: Test API Schema
run: >
poetry run python utility_scripts/api/api_schema_validate.py
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: hub-api-files
path: "_hub_api/*"
publish:
runs-on: ubuntu-latest
environment: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && 'production' || 'preview' }}
needs: build
if: ${{ github.actor != 'dependabot[bot]' }}
permissions:
id-token: write # This is required for requesting the JWT
steps:
- uses: actions/[email protected]
- name: Configure AWS credentials
uses: aws-actions/[email protected]
with:
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
aws-region: us-west-2
role-session-name: "GitHubActions"
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: hub-api-files
path: "_hub_api"
- name: Upload to S3
run: |
aws s3 sync _hub_api s3://${{ secrets.HUB_API_S3_BUCKET }}/hub-api