mirror of
https://github.com/simstudioai/sim.git
synced 2026-01-08 22:48:14 -05:00
81 lines
2.8 KiB
YAML
81 lines
2.8 KiB
YAML
name: Trigger.dev Deploy
|
|
|
|
on:
|
|
workflow_call:
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
deploy:
|
|
name: Deploy to Trigger.dev
|
|
runs-on: blacksmith-4vcpu-ubuntu-2404
|
|
concurrency:
|
|
group: trigger-deploy-${{ github.ref }}
|
|
cancel-in-progress: false
|
|
env:
|
|
TRIGGER_ACCESS_TOKEN: ${{ secrets.TRIGGER_ACCESS_TOKEN }}
|
|
permissions:
|
|
id-token: write
|
|
contents: read
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Node
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: latest
|
|
|
|
- name: Setup Bun
|
|
uses: oven-sh/setup-bun@v2
|
|
with:
|
|
bun-version: latest
|
|
|
|
- name: Install dependencies
|
|
run: bun install
|
|
|
|
- name: Configure AWS credentials
|
|
uses: aws-actions/configure-aws-credentials@v4
|
|
with:
|
|
role-to-assume: ${{ github.ref == 'refs/heads/main' && secrets.AWS_ROLE_TO_ASSUME || secrets.STAGING_AWS_ROLE_TO_ASSUME }}
|
|
aws-region: ${{ github.ref == 'refs/heads/main' && secrets.AWS_REGION || secrets.STAGING_AWS_REGION }}
|
|
|
|
- name: Deploy to Trigger.dev (Staging)
|
|
if: github.ref == 'refs/heads/staging'
|
|
id: deploy-staging
|
|
working-directory: ./apps/sim
|
|
run: |
|
|
OUTPUT=$(npx --yes trigger.dev@4.0.4 deploy -e staging --skip-promotion 2>&1)
|
|
echo "$OUTPUT"
|
|
VERSION=$(echo "$OUTPUT" | grep -oP 'Successfully deployed version \K[0-9]+\.[0-9]+' || echo "$OUTPUT" | grep -oP 'version \K[0-9]+\.[0-9]+' | head -1)
|
|
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
|
echo "Deployed version: $VERSION"
|
|
|
|
- name: Store Staging version in Parameter Store
|
|
if: github.ref == 'refs/heads/staging'
|
|
run: |
|
|
aws ssm put-parameter \
|
|
--name "${{ secrets.TRIGGER_VERSION_SECRET_MANAGER_STAGING }}" \
|
|
--value "${{ steps.deploy-staging.outputs.version }}" \
|
|
--type "String" \
|
|
--overwrite
|
|
|
|
- name: Deploy to Trigger.dev (Production)
|
|
if: github.ref == 'refs/heads/main'
|
|
id: deploy-production
|
|
working-directory: ./apps/sim
|
|
run: |
|
|
OUTPUT=$(npx --yes trigger.dev@4.0.4 deploy --skip-promotion 2>&1)
|
|
echo "$OUTPUT"
|
|
VERSION=$(echo "$OUTPUT" | grep -oP 'Successfully deployed version \K[0-9]+\.[0-9]+' || echo "$OUTPUT" | grep -oP 'version \K[0-9]+\.[0-9]+' | head -1)
|
|
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
|
echo "Deployed version: $VERSION"
|
|
|
|
- name: Store Production version in Parameter Store
|
|
if: github.ref == 'refs/heads/main'
|
|
run: |
|
|
aws ssm put-parameter \
|
|
--name "${{ secrets.TRIGGER_VERSION_SECRET_MANAGER_PROD }}" \
|
|
--value "${{ steps.deploy-production.outputs.version }}" \
|
|
--type "String" \
|
|
--overwrite |