Skip to content

Commit

Permalink
chore: re-integrates fly-based deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
akoenig committed Apr 18, 2024
1 parent 1722e7d commit 2d51ee7
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 54 deletions.
72 changes: 20 additions & 52 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -1,60 +1,28 @@
name: Deploy to Google Cloud Run

name: "Deploy to fly.io"
on:
push:
branches:
- main

env:
PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}
REGION: ${{ secrets.GCP_REGION }}
IMAGE_URL: ${{ secrets.GCP_REGION }}-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/getactions/production:latest

jobs:
build-deploy:
name: Build and Deploy
deploy:
runs-on: ubuntu-latest

permissions:
contents: read
id-token: write

steps:
- name: Checkout
uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v1

- name: Install dependencies
run: bun i --frozen-lockfile

- name: Populate latest workflows
run: bun run populate-workflows

- name: Authenticate with Google Cloud
uses: google-github-actions/auth@v2
with:
project_id: ${{ secrets.GCP_PROJECT_ID }}
workload_identity_provider: ${{ secrets.GCP_IDENTITY_PROVIDER }}
export_environment_variables: 'true'

- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v2
with:
project_id: ${{ secrets.GCP_PROJECT_ID }}

- name: Configure Docker for Google Artifact Registry
run: gcloud auth configure-docker ${{ env.REGION }}-docker.pkg.dev

- name: Build container image
run: docker build . --tag ${{ env.IMAGE_URL }}

- name: Push container image
run: docker push ${{ env.IMAGE_URL }}

- name: Deploy to Cloud Run
run: |
gcloud run deploy production \
--image ${{ env.IMAGE_URL }} \
--platform managed \
--region ${{ env.REGION }} \
--allow-unauthenticated
- name: Checkout code
uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v1
- uses: superfly/flyctl-actions/[email protected]

- name: Install dependencies
run: bun i --frozen-lockfile

- name: Populate latest workflows
run: bun run populate-workflows

- name: Fly!
run: |
flyctl deploy \
--remote-only \
--no-cache \
--app ${{ secrets.PRODUCTION_FLY_APP_NAME }} \
--access-token ${{ secrets.FLY_API_TOKEN }}
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ ARG NODE_VERSION=20

FROM node:${NODE_VERSION}-slim as build

ARG BUN_VERSION=1.0.35
ARG BUN_VERSION=1.0.36

WORKDIR /build

Expand Down
3 changes: 2 additions & 1 deletion devbox.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"[email protected]",
"nodejs@20",
"google-cloud-sdk@latest",
"[email protected]"
"[email protected]",
"[email protected]"
]
}
48 changes: 48 additions & 0 deletions devbox.lock
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,54 @@
}
}
},
"[email protected]": {
"last_modified": "2024-03-27T22:32:31-04:00",
"resolved": "github:NixOS/nixpkgs/bb2b73df7bcfbd2dd55ff39b944d70547d53c267#flyctl",
"source": "devbox-search",
"version": "0.2.25",
"systems": {
"aarch64-darwin": {
"outputs": [
{
"name": "out",
"path": "/nix/store/imld7iki0qwwz2rijrhcch8qazjvviki-flyctl-0.2.25",
"default": true
}
],
"store_path": "/nix/store/imld7iki0qwwz2rijrhcch8qazjvviki-flyctl-0.2.25"
},
"aarch64-linux": {
"outputs": [
{
"name": "out",
"path": "/nix/store/svdfgrm44kbp9v06q3msnb02ylmqjjdi-flyctl-0.2.25",
"default": true
}
],
"store_path": "/nix/store/svdfgrm44kbp9v06q3msnb02ylmqjjdi-flyctl-0.2.25"
},
"x86_64-darwin": {
"outputs": [
{
"name": "out",
"path": "/nix/store/pjzqdpdk8l2yadpfyxfjqffrqd9hir3i-flyctl-0.2.25",
"default": true
}
],
"store_path": "/nix/store/pjzqdpdk8l2yadpfyxfjqffrqd9hir3i-flyctl-0.2.25"
},
"x86_64-linux": {
"outputs": [
{
"name": "out",
"path": "/nix/store/y6asn5gjaz3xvkas1dl3151rdrdx4hha-flyctl-0.2.25",
"default": true
}
],
"store_path": "/nix/store/y6asn5gjaz3xvkas1dl3151rdrdx4hha-flyctl-0.2.25"
}
}
},
"[email protected]": {
"last_modified": "2024-03-22T11:26:23Z",
"resolved": "github:NixOS/nixpkgs/a3ed7406349a9335cb4c2a71369b697cecd9d351#go",
Expand Down

0 comments on commit 2d51ee7

Please sign in to comment.