Skip to content

Commit

Permalink
feat: adds fly deploy github action
Browse files Browse the repository at this point in the history
  • Loading branch information
arthurgeek committed Jul 12, 2023
1 parent 155eeaf commit 3d9891b
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@
"matchStrings": [
"datasource=(?<datasource>.*?) depName=(?<depName>.*?)\\sARG .*?_VERSION=(?<currentValue>v.*)\\s"
]
},
{
"fileMatch": ["^\\.github\\/workflows\\/fly-deploy\\.yaml$"],
"matchStrings": [
"datasource=(?<datasource>.*?) depName=(?<depName>.*?)\\sversion:\\s(?<currentValue>.*)\\s"
]
}
]
}
51 changes: 51 additions & 0 deletions .github/workflows/fly-deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Deploy to Fly

on:
workflow_dispatch: {}
push:
branches:
- main
paths:
- Dockerfile
- fly.toml
- config/**
- scripts/**

jobs:
check-fly-secret:
runs-on: ubuntu-latest
outputs:
fly-secret-exists: ${{ steps.fly-secret-check.outputs.defined }}
steps:
- name: Check for Fly secrets availability
id: fly-secret-check
# perform secret check & put boolean result as an output
shell: bash
run: |
if [ "${{ secrets.FLY_API_TOKEN }}" != '' ] && [ "${{ secrets.FLY_APP }}" != '' ]; then
echo "defined=true" >> $GITHUB_OUTPUT;
else
echo "defined=false" >> $GITHUB_OUTPUT;
fi
deploy:
name: Deploy app
runs-on: ubuntu-latest
needs: [check-fly-secret]
if: needs.check-fly-secret.outputs.fly-secret-exists == 'true'
steps:
- uses: actions/checkout@v2
- uses: superfly/flyctl-actions/setup-flyctl@master
with:
version: 0.1.54
- name: Install Task
uses: arduino/setup-task@v1
with:
# renovate: datasource=github-releases depName=go-task/task
version: 3.27.1
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Deploy app
run: flyctl deploy --remote-only -a $FLY_APP
env:
FLY_APP: ${{ secrets.FLY_APP }}
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}

0 comments on commit 3d9891b

Please sign in to comment.