mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-27 20:44:07 +00:00
cfc746d558
Summary: fly.io made some breaking changes between so we need to bump up version from 1.16 to 1.18. Also, volumes cannot have name in more than 30 characters so i've introducent trimming mechanism for volume names Test Plan: I've deployed preview with that settings and it went OK. Reviewers: jarek Reviewed By: jarek Differential Revision: https://phab.getgrist.com/D4033
65 lines
2.3 KiB
YAML
65 lines
2.3 KiB
YAML
name: Fly Deploy
|
|
on:
|
|
pull_request:
|
|
branches: [ main ]
|
|
types: [labeled, unlabeled, closed, opened, synchronize, reopened]
|
|
|
|
# Allows running this workflow manually from the Actions tab
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
|
|
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
|
|
|
|
jobs:
|
|
deploy:
|
|
name: Deploy app
|
|
runs-on: ubuntu-latest
|
|
# Deploy when the 'preview' label is added, or when PR is updated with this label present.
|
|
if: |
|
|
github.repository_owner == 'gristlabs' &&
|
|
github.event_name == 'pull_request' && (
|
|
github.event.action == 'labeled' ||
|
|
github.event.action == 'opened' ||
|
|
github.event.action == 'synchronize' ||
|
|
github.event.action == 'reopened'
|
|
) &&
|
|
contains(github.event.pull_request.labels.*.name, 'preview')
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: superfly/flyctl-actions/setup-flyctl@master
|
|
with:
|
|
version: 0.1.89
|
|
- id: fly_deploy
|
|
run: |
|
|
node buildtools/fly-deploy.js deploy
|
|
flyctl config -c ./fly.toml env | awk '/APP_HOME_URL/{print "DEPLOY_URL=" $2}' >> $GITHUB_OUTPUT
|
|
flyctl config -c ./fly.toml env | awk '/FLY_DEPLOY_EXPIRATION/{print "EXPIRES=" $2}' >> $GITHUB_OUTPUT
|
|
|
|
- uses: actions/github-script@v6
|
|
with:
|
|
script: |
|
|
github.rest.issues.createComment({
|
|
issue_number: context.issue.number,
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
body: `Deployed as ${{ steps.fly_deploy.outputs.DEPLOY_URL }} (until ${{ steps.fly_deploy.outputs.EXPIRES }})`
|
|
})
|
|
|
|
destroy:
|
|
name: Remove app
|
|
runs-on: ubuntu-latest
|
|
# Remove the deployment when 'preview' label is removed, or the PR is closed.
|
|
if: |
|
|
github.repository_owner == 'gristlabs' &&
|
|
github.event_name == 'pull_request' &&
|
|
(github.event.action == 'closed' ||
|
|
(github.event.action == 'unlabeled' && github.event.label.name == 'preview'))
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: superfly/flyctl-actions/setup-flyctl@master
|
|
with:
|
|
version: 0.1.89
|
|
- id: fly_destroy
|
|
run: node buildtools/fly-deploy.js destroy
|