Skip to content

Commit

Permalink
create versioned image (#246)
Browse files Browse the repository at this point in the history
In this PR I created a backup image based on the version patch of
`apps/web` version
  • Loading branch information
JoaoVictor6 authored Apr 11, 2024
1 parent 71b1a50 commit bb31486
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 2 deletions.
36 changes: 34 additions & 2 deletions .github/workflows/build-next.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,39 @@ on:
- main

jobs:
upgrade-project-version:
if: ${{ !contains(github.event.head_commit.message, '[RELEASE]') }}
runs-on: ubuntu-latest
defaults:
run:
working-directory: apps/web/
steps:
-
name: checkout
uses: actions/checkout@v3
-
name: setup node
uses: actions/setup-node@v4
with:
node-version: 20
-
name: Upgrade project version
id: upgrade-version-step
run: |
npm version patch &&
NEW_VERSION=$(cat package.json | jq -r '.version')
echo "Version clean is $NEW_VERSION"
echo API_VERSION=$NEW_VERSION >> $GITHUB_OUTPUT
git config user.name "GitHub Actions Bot"
git config user.email "<>"
git add .
git commit -m "[RELEASE] $NEW_VERSION"
git push
outputs:
API_VERSION: ${{ steps.upgrade-version-step.outputs.API_VERSION }}

docker-build:
needs: [upgrade-project-version]
runs-on: ubuntu-latest

steps:
Expand All @@ -30,7 +62,7 @@ jobs:

- name: Build Docker image
run: |
docker buildx build . --platform linux/arm64 -t "gru.ocir.io/gricbxnlp2kb/trampar-de-casa:latest" --push \
docker buildx build . --platform linux/arm64 -t "gru.ocir.io/gricbxnlp2kb/trampar-de-casa:latest" -t "gru.ocir.io/gricbxnlp2kb/trampar-de-casa:$(cd apps/web && cat package.json | jq -r '.version')" --push \
--build-arg DATABASE_URL="${{ secrets.DATABASE_URL }}" \
--build-arg SUPABASE_URL="${{ secrets.SUPABASE_URL }}" \
--build-arg SUPABASE_SERVICE_ROLE="${{ secrets.SUPABASE_SERVICE_ROLE }}" \
Expand All @@ -41,4 +73,4 @@ jobs:
--build-arg RESEND_WEBHOOK_SECRET="${{ secrets.RESEND_WEBHOOK_SECRET }}" \
--build-arg OWNER_EMAIL="${{ secrets.OWNER_EMAIL }}" \
--build-arg NEXT_PUBLIC_MIXPANEL_KEY="${{ secrets.NEXT_PUBLIC_MIXPANEL_KEY }}" \
--build-arg CRON_SECRET="${{ secrets.CRON_SECRET }}"
--build-arg CRON_SECRET="${{ secrets.CRON_SECRET }}"
32 changes: 32 additions & 0 deletions .github/workflows/verify-image-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Verify docker build

on:
push:
branches:
- '**'
- '!main'

jobs:
Build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Docker Setup Buildx
uses: docker/[email protected]

- name: Build Docker image
run: |
docker buildx build --platform linux/arm64 --load -t local-image:local . \
--build-arg DATABASE_URL="${{ secrets.DATABASE_URL }}" \
--build-arg SUPABASE_URL="${{ secrets.SUPABASE_URL }}" \
--build-arg SUPABASE_SERVICE_ROLE="${{ secrets.SUPABASE_SERVICE_ROLE }}" \
--build-arg EMAIL_KEY="${{ secrets.EMAIL_KEY }}" \
--build-arg EMAIL_PASS="${{ secrets.EMAIL_PASS }}" \
--build-arg CRYPT_SECRET="${{ secrets.CRYPT_SECRET }}" \
--build-arg RESEND_KEY="${{ secrets.RESEND_KEY }}" \
--build-arg RESEND_WEBHOOK_SECRET="${{ secrets.RESEND_WEBHOOK_SECRET }}" \
--build-arg OWNER_EMAIL="${{ secrets.OWNER_EMAIL }}" \
--build-arg NEXT_PUBLIC_MIXPANEL_KEY="${{ secrets.NEXT_PUBLIC_MIXPANEL_KEY }}" \
--build-arg CRON_SECRET="${{ secrets.CRON_SECRET }}"

0 comments on commit bb31486

Please sign in to comment.