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: Push Registry App Files to Supabase | |
on: | |
push: | |
branches: | |
- biz/dj-2899-create-a-github-action-to-upsert-any-changed-app-files-into | |
paths: | |
- 'components/**' | |
jobs: | |
push_to_supabase: | |
name: Push registry app files to Supabase if they have been modified | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
pull-requests: write | |
steps: | |
- uses: actions/[email protected] | |
name: Checkout repo | |
with: | |
# https://github.com/actions/checkout/issues/266#issuecomment-638346893 | |
fetch-depth: 0 | |
- uses: Ana06/[email protected] | |
id: changed_files | |
name: Get changed files | |
with: | |
format: json | |
- name: Upload modified or newly added *.app.mjs files to Supabase | |
uses: ./.github/actions/push-registry-app-files-supabase | |
with: | |
changed_files: ${{ steps.changed_files.outputs.all }} | |
# verify-typescript-components: | |
# name: Verify TypeScript components | |
# runs-on: ubuntu-latest | |
# | |
# steps: | |
# - name: Checkout code | |
# uses: actions/[email protected] | |
# - uses: pnpm/[email protected] | |
# with: | |
# version: 9.14.2 | |
# - name: Get pnpm store directory | |
# id: pnpm-cache | |
# run: | | |
# echo "::set-output name=pnpm_cache_dir::$(pnpm store path)" | |
# - uses: actions/cache@v4 | |
# name: Setup pnpm cache | |
# with: | |
# path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }} | |
# key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
# restore-keys: | | |
# ${{ runner.os }}-pnpm-store- | |
# - name: Setup Node Env | |
# uses: actions/[email protected] | |
# with: | |
# node-version: 18 | |
# registry-url: https://registry.npmjs.org/ | |
# cache: 'pnpm' | |
# - name: Install Dependencies | |
# run: pnpm install -r | |
# - name: Compile TypeScript | |
# id: compile | |
# run: pnpm run build > files.txt | |
# - name: Get Changed Files | |
# id: files | |
# uses: Ana06/[email protected] | |
# with: | |
# format: 'csv' | |
# - name: Check For Compiled TypeScript Files | |
# run: | | |
# IFS=$'\n' | |
# # Remove initial tsc output | |
# output_files=$(cat files.txt | sed 1,3d) | |
# declare -a ERRORS | |
# declare -a SKIPPED | |
# mapfile -d ',' -t added_modified_renamed_files < <(printf '%s,%s' '${{ steps.files.outputs.added_modified }}' '${{ steps.files.outputs.renamed }}') | |
# for added_modified_file in "${added_modified_renamed_files[@]}"; | |
# do | |
# echo "Checking if $added_modified_file is a publishable ts file" | |
# if [[ $added_modified_file == components/* ]] && [[ $added_modified_file == *.ts ]] && [[ $added_modified_file != *.app.ts ]] \ | |
# && [[ $added_modified_file != */common*.ts ]] && [[ $added_modified_file != */common/* ]] | |
# then | |
# # XXX This is a hacky way to publish only TS components with changes. If a changed | |
# # file "path-a/path-b/c.ts" has a corresponding compiled output file | |
# # "path-a/dist/path-b/c.mjs", attempt to publish the output `.mjs` file. | |
# changed_output_file="" | |
# for f in $output_files; # check each output file for a match | |
# do | |
# # Replaces /dist/path/filename.mjs with /path/filename.ts | |
# maybe_source_file=$(echo "$f" | sed 's/\/dist\//\//;s/.mjs/\.ts/') | |
# if [[ ${maybe_source_file} == **/${added_modified_file} ]] | |
# then | |
# changed_output_file=${f} | |
# break | |
# fi | |
# done | |
# if [[ $changed_output_file == "" ]] | |
# then | |
# ERROR_MESSAGE="cannot find an output .mjs file with ${added_modified_file}" | |
# echo $ERROR_MESSAGE | |
# ERRORS+=("*${ERROR_MESSAGE}") | |
# fi | |
# else | |
# echo "$added_modified_file will not be added to the registry" | |
# SKIPPED+=("*$added_modified_file") | |
# fi | |
# done | |
# if [[ ${#SKIPPED[@]} -ne 0 ]]; then | |
# echo "the following files were skipped:" | |
# printf '%s\n' "${SKIPPED[@]}" | |
# fi | |
# if [[ ${#ERRORS[@]} -ne 0 ]]; then | |
# echo "the following files generated errors:" | |
# printf '%s\n' "${ERRORS[@]}" | |
# echo "Please check if the components above were successfully compiled" | |
# echo "More information here: https://pipedream.com/docs/components/typescript/#developing-typescript-components-in-the-pipedreamhq-pipedream-registry" | |
# exit 1 | |
# fi | |
# unset IFS | |
# publish-typescript-components-dry-run: | |
# name: Publish TypeScript components | |
# runs-on: ubuntu-latest | |
# | |
# steps: | |
# - name: Checkout code | |
# uses: actions/[email protected] | |
# - uses: pnpm/[email protected] | |
# with: | |
# version: 9.14.2 | |
# - name: Get pnpm store directory | |
# id: pnpm-cache | |
# run: | | |
# echo "::set-output name=pnpm_cache_dir::$(pnpm store path)" | |
# - uses: actions/cache@v4 | |
# name: Setup pnpm cache | |
# with: | |
# path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }} | |
# key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
# restore-keys: | | |
# ${{ runner.os }}-pnpm-store- | |
# - name: Setup Node Env | |
# uses: actions/[email protected] | |
# with: | |
# node-version: 18 | |
# registry-url: https://registry.npmjs.org/ | |
# cache: 'pnpm' | |
# - name: Install Dependencies | |
# run: pnpm install -r | |
# - name: Compile TypeScript | |
# id: compile | |
# run: pnpm run build > files.txt | |
# - name: Get Changed Files | |
# id: files | |
# uses: Ana06/[email protected] | |
# with: | |
# format: 'csv' | |
# - name: Publish TypeScript components (dry run) | |
# shell: bash {0} # don't fast fail | |
# run: | | |
# IFS=$'\n' | |
# mapfile -d ',' -t added_modified_renamed_files < <(printf '%s,%s' '${{ steps.files.outputs.added_modified }}' '${{ steps.files.outputs.renamed }}') | |
# # Remove initial tsc output | |
# output_files=$(cat files.txt | sed 1,3d) | |
# echo "The following files will be published on merge:" | |
# for added_modified_file in "${added_modified_renamed_files[@]}"; | |
# do | |
# # starts with components, ends with .ts and not app.ts, doesn't end with /common*.ts, | |
# # and doesn't follow */common/ | |
# if [[ $added_modified_file == components/* ]] && [[ $added_modified_file == *.ts ]] && [[ $added_modified_file != *.app.ts ]] \ | |
# && [[ $added_modified_file != */common*.ts ]] && [[ $added_modified_file != */common/* ]] | |
# then | |
# # XXX This is a hacky way to publish only TS components with changes. If a changed | |
# # file "path-a/path-b/c.ts" has a corresponding compiled output file | |
# # "path-a/dist/path-b/c.mjs", attempt to publish the output `.mjs` file. | |
# for f in $output_files; | |
# do | |
# # Replaces /dist/path/filename.mjs with /path/filename.ts | |
# maybe_source_file=$(echo "$f" | sed 's/\/dist\//\//;s/.mjs/\.ts/') | |
# if [[ ${maybe_source_file} == **/${added_modified_file} ]] | |
# then | |
# echo "$f" | |
# fi | |
# done | |
# fi | |
# done | |
# unset IFS |