chore(main): Release transformation-gcp-compliance-free v1.3.0 (#300) #13
Workflow file for this run
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: Publish transformation | |
on: | |
push: | |
tags: | |
- "transformation-*-v*.*.*" | |
jobs: | |
prepare: | |
runs-on: ubuntu-latest | |
outputs: | |
transformation_dir: ${{ fromJson(steps.set-result.outputs.result).transformation_dir }} | |
transformation_version: ${{ fromJson(steps.set-result.outputs.result).transformation_version }} | |
steps: | |
- uses: actions/github-script@v7 | |
id: set-result | |
env: | |
TRANSFORMATION_TAG: ${{ github.ref_name }} | |
with: | |
script: | | |
const { TRANSFORMATION_TAG } = process.env; | |
const [_, topLevelDir, ...rest] = TRANSFORMATION_TAG.split('-'); | |
const version = rest.pop(); | |
return { | |
transformation_dir: `${topLevelDir}/${rest.join('-')}`, | |
transformation_version: version, | |
}; | |
publish-transformation: | |
needs: prepare | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:11 | |
env: | |
POSTGRES_PASSWORD: pass | |
POSTGRES_USER: postgres | |
POSTGRES_DB: postgres | |
ports: | |
- 5432:5432 | |
# Set health checks to wait until postgres has started | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Update Release Notes | |
uses: actions/github-script@v7 | |
env: | |
TRANSFORMATION_DIR: ${{ needs.prepare.outputs.transformation_dir }} | |
with: | |
script: | | |
const fs = require('fs/promises'); | |
const { TRANSFORMATION_DIR } = process.env; | |
const { data } = await github.rest.repos.getReleaseByTag({ | |
owner: "cloudquery", | |
repo: context.repo.repo, | |
tag: context.ref.replace('refs/tags/', ''), | |
}); | |
const releaseNotes = data.body; | |
const linksRemoved = releaseNotes.replace(/\[([^\]]+)\]\([^)]+\)/g, '$1'); | |
const changelogPath = `transformations/${TRANSFORMATION_DIR}/changelog.md`; | |
await fs.writeFile(changelogPath, linksRemoved); | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.9" | |
cache: "pip" | |
cache-dependency-path: "./transformations/${{ needs.prepare.outputs.transformation_dir }}/requirements.txt" | |
- name: Install dependencies | |
working-directory: transformations/${{ needs.prepare.outputs.transformation_dir }} | |
run: pip install -r requirements.txt | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 'lts/*' | |
cache: 'npm' | |
cache-dependency-path: scripts/dbt-pack/package-lock.json | |
- name: Install Dependencies | |
run: npm ci | |
working-directory: ./scripts/dbt-pack | |
- name: Pack DBT | |
working-directory: ./scripts/dbt-pack | |
run: node index.js dbt-pack --project-dir=../../transformations/${{ needs.prepare.outputs.transformation_dir }} | |
- name: Setup CloudQuery | |
uses: cloudquery/setup-cloudquery@v3 | |
with: | |
version: v4.0.0 | |
- name: Publish tranformation | |
working-directory: transformations/${{ needs.prepare.outputs.transformation_dir }} | |
env: | |
CLOUDQUERY_API_KEY: ${{ secrets.CLOUDQUERY_API_KEY }} | |
run: | | |
cloudquery addon publish manifest.json ${{ needs.prepare.outputs.transformation_version }} -f |