-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
26 additions
and
43 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,6 @@ on: | |
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
deploy: | ||
name: Deploy app | ||
|
@@ -13,55 +12,39 @@ jobs: | |
steps: | ||
- name: Checkout ποΈ | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Fly π§° | ||
uses: superfly/flyctl-actions/setup-flyctl@master | ||
|
||
- name: Install GitHub CLI π | ||
uses: actions/setup-gh@v3 | ||
|
||
- name: Create GitHub Deployment π’ | ||
- name: Create GitHub Deployment π | ||
id: create_deployment | ||
run: | | ||
gh auth setup-git | ||
gh auth status | ||
gh api repos/${{ github.repository }}/deployments \ | ||
-X POST \ | ||
-F ref=${{ github.ref }} \ | ||
-F environment=production \ | ||
-F description="Deploying the application to Fly.io" \ | ||
-F required_contexts=[] \ | ||
-F auto_merge=false \ | ||
-q '.id' > deployment-id.txt | ||
DEPLOYMENT_ID=$(cat deployment-id.txt) | ||
echo "deployment_id=$DEPLOYMENT_ID" >> $GITHUB_ENV | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
uses: octokit/[email protected] | ||
with: | ||
route: POST /repos/${{ github.repository }}/deployments | ||
environment: production | ||
ref: ${{ github.sha }} | ||
description: "Deploying to Fly.io" | ||
auto_merge: false | ||
|
||
- name: Deploy to Fly.io π©οΈ | ||
id: deploy | ||
run: flyctl deploy --remote-only | ||
env: | ||
FLY_API_TOKEN: ${{ secrets.FLY_TOKEN }} | ||
|
||
- name: Set deployment status to success β | ||
if: success() | ||
uses: octokit/[email protected] | ||
with: | ||
route: POST /repos/${{ github.repository }}/deployments/${{ steps.create_deployment.outputs.id }}/statuses | ||
state: success | ||
description: "β Deployment Succeeded π₯³" | ||
environment: production | ||
|
||
- name: Update GitHub Deployment Status to Success β | ||
if: ${{ success() }} | ||
run: | | ||
gh api repos/${{ github.repository }}/deployments/${{ env.deployment_id }}/statuses \ | ||
-X POST \ | ||
-F state=success \ | ||
-F environment_url=https://api.web-check.xyz \ | ||
-F description='β Deployment successful! π₯³' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Update GitHub Deployment Status to Failure π« | ||
if: ${{ failure() }} | ||
run: | | ||
gh api repos/${{ github.repository }}/deployments/${{ env.deployment_id }}/statuses \ | ||
-X POST \ | ||
-F state=failure \ | ||
-F environment_url=https://api.web-check.xyz \ | ||
-F description='π« Deployment failed π₯' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Set deployment status to failure β | ||
if: failure() | ||
uses: octokit/[email protected] | ||
with: | ||
route: POST /repos/${{ github.repository }}/deployments/${{ steps.create_deployment.outputs.id }}/statuses | ||
state: failure | ||
description: "β Deployment Failed π₯" | ||
environment: production |