Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .github/workflows/api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ jobs:
--region=global \
--project=httpsms-86c51 \
--sha=${{ github.sha }} \
--substitutions=_VERSION=${{ github.run_number }} \
--format="value(metadata.build.id)")
echo -e "Cloud Build: \033[34mhttps://console.cloud.google.com/cloud-build/builds/$BUILD_ID?project=httpsms-86c51\033[0m"
echo ""
Expand All @@ -133,3 +134,13 @@ jobs:
esac
sleep 30
done

deploy-web:
name: Deploy Web
needs: deploy
permissions:
contents: read
pull-requests: write
deployments: write
uses: ./.github/workflows/web.yml
secrets: inherit
10 changes: 4 additions & 6 deletions .github/workflows/web.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
name: web

on:
push:
branches:
- main
workflow_call:
pull_request:
branches:
- main
Expand Down Expand Up @@ -46,7 +44,7 @@ jobs:
run: pnpm test

- name: Build 🏗️
run: mv .env.production .env && echo "GITHUB_SHA=${GITHUB_SHA}" >> .env && pnpm run generate
run: mv .env.production .env && pnpm run generate

deploy:
name: Deploy
Expand All @@ -61,7 +59,7 @@ jobs:
- name: Setup Node 🟢
uses: actions/setup-node@v7
with:
node-version: '24.18'
node-version: "24.18"

- uses: pnpm/action-setup@v6
name: Install pnpm
Expand All @@ -72,7 +70,7 @@ jobs:
run: pnpm install --trust-lockfile

- name: Build 🏗️
run: mv .env.production .env && echo "GITHUB_SHA=${GITHUB_SHA}" >> .env && pnpm run generate
run: mv .env.production .env && pnpm run generate

- name: Cloudflare Deploy 🚀
uses: cloudflare/wrangler-action@v4
Expand Down
5 changes: 2 additions & 3 deletions api/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
FROM golang AS builder

ARG GIT_COMMIT
ENV GIT_COMMIT=$GIT_COMMIT
ARG VERSION

WORKDIR /http-sms

Expand All @@ -17,7 +16,7 @@ RUN go get github.com/swaggo/swag/cmd/swag@latest
RUN go install github.com/swaggo/swag/cmd/swag
RUN swag init --requiredByDefault --parseDependency --parseInternal

RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-X main.Version=$GIT_COMMIT" -o /bin/http-sms .
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-X main.Version=$VERSION" -o /bin/http-sms .

FROM alpine:latest

Expand Down
7 changes: 4 additions & 3 deletions api/cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ steps:
id: "Build image and push"
dir: "api"
args:
- "--destination=us.gcr.io/$PROJECT_ID/$_SERVICE_NAME:$SHORT_SHA"
- "--destination=us.gcr.io/$PROJECT_ID/$_SERVICE_NAME:$_VERSION"
- "--destination=us.gcr.io/$PROJECT_ID/$_SERVICE_NAME:latest"
- "--dockerfile=Dockerfile"
- "--context=."
- "--build-arg=GIT_COMMIT=$SHORT_SHA"
- "--build-arg=VERSION=$_VERSION"
- "--snapshot-mode=time"

- id: "Deploy to cloud run"
Expand All @@ -17,7 +17,7 @@ steps:
- "-c"
- |
gcloud run deploy $_SERVICE_NAME \
--image=us.gcr.io/$PROJECT_ID/$_SERVICE_NAME:$SHORT_SHA \
--image=us.gcr.io/$PROJECT_ID/$_SERVICE_NAME:$_VERSION \
--region=$_REGION --platform managed --allow-unauthenticated \
--port=8000
options:
Expand All @@ -26,3 +26,4 @@ options:
substitutions:
_SERVICE_NAME: http-sms-api
_REGION: us-east1
_VERSION: dev
2 changes: 1 addition & 1 deletion web/nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export default defineNuxtConfig({
runtimeConfig: {
public: {
apiBaseUrl: process.env.API_BASE_URL || 'http://localhost:8000',
clientVersion: process.env.GITHUB_SHA || 'dev',
clientVersion: process.env.GITHUB_RUN_NUMBER || 'dev',
appUrl: process.env.APP_URL || 'https://httpsms.com',
appName: process.env.APP_NAME || 'HTTP SMS',
appGithubUrl:
Expand Down
Loading