api services package #1494
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: Preview | |
on: | |
pull_request: | |
types: [opened, reopened, synchronize, closed] | |
concurrency: | |
group: pr-${{ github.event.number }} | |
jobs: | |
detect-changes: | |
runs-on: ubuntu-latest | |
outputs: | |
projects: ${{ steps.changes.outputs.all_changed_files }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Detect changes in migrations | |
id: changes | |
uses: tj-actions/changed-files@v37 | |
with: | |
json: "true" | |
escape_json: "false" | |
dir_names: "true" | |
dir_names_exclude_current_dir: "true" | |
dir_names_max_depth: 1 | |
# Modify the following list of directories with new projects | |
files: | | |
tasks/** | |
- name: Summarize changes | |
run: | | |
echo "projects: $projects" >> $GITHUB_STEP_SUMMARY | |
env: | |
projects: ${{ steps.changes.outputs.all_changed_files }} | |
preview: | |
runs-on: ubuntu-latest | |
needs: detect-changes | |
if: needs.detect-changes.outputs.projects != '[]' | |
strategy: | |
matrix: | |
project: ${{ fromJson(needs.detect-changes.outputs.projects) }} | |
# TODO: Migrate to GitHub Environment | |
# environment: | |
# name: pr-${{ github.event.number }}-${{ matrix.project }} | |
# url: ${{ steps.deploy.outputs.url }} | |
env: | |
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} | |
FLY_REGION: ${{ vars.PREVIEW_FLY_REGION || 'ams' }} | |
FLY_ORG: ${{ vars.PREVIEW_FLY_ORGANIZATION }} | |
steps: | |
- uses: actions/checkout@v4 | |
# --copy-config uses a fly.toml from the current working directory | |
# as a base configuration for the new app | |
- name: Prepare fly.toml for `fly launch --copy-config` | |
run: | | |
cp ${{ matrix.project }}/fly.toml . | |
sed -i "s/\.\.\/Dockerfile/Dockerfile/g" fly.toml | |
- name: Deploy preview to Fly | |
id: deploy | |
uses: superfly/[email protected] | |
with: | |
name: pr-${{ github.event.number }}-${{ github.repository_owner }}-${{ github.event.repository.name }}-${{ matrix.project }} | |
config: ${{ matrix.project }}/fly.toml | |
- name: Comment preview url to pull-request | |
uses: thollander/actions-comment-pull-request@v2 | |
with: | |
comment_tag: preview_${{ matrix.project }} | |
mode: ${{ github.event.action == 'closed' && 'delete' || 'upsert' }} | |
message: | | |
### Preview of ${{ matrix.project }} | |
${{ steps.deploy.outputs.url }} |