Skip to content

Commit a842915

Browse files
authored
Merge pull request #1 from nanoapi-io/chore/setup-ci-app-and-core
setup ci app and core
2 parents 19444c5 + 6ac99ba commit a842915

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

.github/workflows/firebase-hosting-merge.yml renamed to .github/workflows/build-and-deploy-app.yml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
1-
# This file was auto-generated by the Firebase CLI
2-
# https://github.com/firebase/firebase-tools
3-
41
name: Deploy to Firebase Hosting on merge
52
on:
6-
push:
7-
branches:
8-
- main
3+
push
4+
95
jobs:
106
build_and_deploy:
117
runs-on: ubuntu-latest
@@ -21,9 +17,12 @@ jobs:
2117
- name: Build Deno SPA
2218
run: |
2319
deno install --allow-scripts --reload
24-
deno task build:app
20+
VITE_API_URL=https://api.nanoapi.io deno task build:app
2521
26-
- uses: FirebaseExtended/action-hosting-deploy@v0
22+
- name: Deploy to Firebase
23+
# only deploy on main branch
24+
if: github.ref == 'refs/heads/main'
25+
uses: FirebaseExtended/action-hosting-deploy@v0
2726
with:
2827
entryPoint: "./packages/app"
2928
repoToken: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/docker-build-push.yml renamed to .github/workflows/build-and-deploy-core.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
name: Build and Push Docker Image
22

33
on:
4-
push:
5-
branches: [main]
4+
push
65

76
env:
87
GITHUB_REGISTRY: ghcr.io
@@ -53,6 +52,8 @@ jobs:
5352

5453
# Build and push to both registries
5554
- name: Build and push Docker image
55+
# only build on main branch
56+
if: github.ref == 'refs/heads/main'
5657
uses: docker/build-push-action@v5
5758
with:
5859
context: packages/core
@@ -66,6 +67,8 @@ jobs:
6667
6768
# Output the image URLs for easy reference
6869
- name: Output image URLs
70+
# only output on main branch
71+
if: github.ref == 'refs/heads/main'
6972
run: |
7073
echo "Images pushed to:"
7174
echo "GitHub: ${{ env.GITHUB_REGISTRY }}/${{ env.GITHUB_IMAGE_NAME }}:${{ github.ref_name }}"
@@ -75,6 +78,8 @@ jobs:
7578
7679
# Update Cloud Run service with the new image
7780
- name: Deploy to Cloud Run
81+
# only deploy on main branch
82+
if: github.ref == 'refs/heads/main'
7883
run: |
7984
gcloud run deploy stackcore-core \
8085
--image=${{ env.GCP_REGISTRY }}/${{ env.GCP_PROJECT_ID }}/${{ env.GCP_REPOSITORY }}/${{ env.GCP_IMAGE_NAME }}:${{ github.ref_name }} \

0 commit comments

Comments
 (0)