From ec71464c3b3d87a5aa67a536139d60a8f0396fe0 Mon Sep 17 00:00:00 2001 From: Martin Jirku Date: Mon, 18 Dec 2023 09:23:43 +0100 Subject: [PATCH] upgrade build pipelines --- .air.toml | 4 ++-- .github/workflows/deploy.yml | 28 ++++++++++++++++++++++++++-- fly.toml | 4 +--- 3 files changed, 29 insertions(+), 7 deletions(-) diff --git a/.air.toml b/.air.toml index f467c2d..6057589 100644 --- a/.air.toml +++ b/.air.toml @@ -9,12 +9,12 @@ cmd = "go build -o ./tmp/main ./main.go" delay = 200 exclude_dir = ["assets", "tmp", "vendor", "node_modules", "styles", "public"] exclude_file = [] -exclude_regex = ["_test.go"] +exclude_regex = ["_test.go", ".ts", ".css"] exclude_unchanged = false follow_symlink = false full_bin = "" include_dir = [] -include_ext = ["go", "tpl", "templ", "html"] +include_ext = ["go"] include_file = [] kill_delay = "0s" log = "build-errors.log" diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index a2151ba..acc73ee 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -2,7 +2,7 @@ name: Build and deploy on: push: - branches: ["migration-to-golang"] + branches: ["migration-to-golang", "dev", "main"] env: FLY_API_TOKEN: ${{ secrets. FLY_API_TOKEN }} jobs: @@ -10,5 +10,29 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + + - name: 👀 Read app name + uses: SebRollen/toml-action@v1.0.2 + id: app_name + with: + file: fly.toml + field: app + - uses: superfly/flyctl-actions/setup-flyctl@master - - run: flyctl deploy + - name: 🚀 Deploy Go + if: ${{ github.ref == 'refs/heads/migration-to-golang' }} + run: flyctl deploy --remote-only --region waw --build-arg COMMIT_SHA=${{ github.sha }} --app ${{ steps.app_name.outputs.value }}-go + env: + FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} + + - name: 🚀 Deploy Staging + if: ${{ github.ref == 'refs/heads/dev' }} + run: flyctl deploy --remote-only --region waw --build-arg COMMIT_SHA=${{ github.sha }} --app ${{ steps.app_name.outputs.value }}-staging + env: + FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} + + - name: 🚀 Deploy Production + if: ${{ github.ref == 'refs/heads/main' }} + run: flyctl deploy --remote-only --region waw --build-arg COMMIT_SHA=${{ github.sha }} --app ${{ steps.app_name.outputs.value }} + env: + FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} diff --git a/fly.toml b/fly.toml index 18433dc..4e4867f 100644 --- a/fly.toml +++ b/fly.toml @@ -3,12 +3,10 @@ # See https://fly.io/docs/reference/configuration/ for information about how to use this file. # -app = "mcmamina-go" +app = "mcmamina" kill_signal = "SIGINT" kill_timeout = 5 -# primary_region = "waw" - [[vm]] cpu_kind = "shared"