Use working Gitea workflow format with ubuntu-latest
Build and Push Docker Image / build (push) Successful in 1m45s
Details
Build and Push Docker Image / build (push) Successful in 1m45s
Details
This commit is contained in:
parent
c426d576fc
commit
cb3703ec3a
|
|
@ -1,50 +1,59 @@
|
|||
name: Build and Deploy
|
||||
name: Build and Push Docker Image
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- master
|
||||
tags:
|
||||
- 'v*'
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
- master
|
||||
|
||||
env:
|
||||
REGISTRY: code.letsbe.solutions
|
||||
IMAGE_NAME: letsbe/monacousa-portal
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Log in to Gitea Container Registry
|
||||
if: github.event_name != 'pull_request'
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
node-version: '20'
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ gitea.actor }}
|
||||
password: ${{ secrets.REGISTRY_TOKEN }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci --legacy-peer-deps
|
||||
- name: Extract metadata (tags, labels)
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
tags: |
|
||||
type=ref,event=branch
|
||||
type=ref,event=pr
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
type=raw,value=latest,enable={{is_default_branch}}
|
||||
|
||||
- name: Build
|
||||
run: npm run build
|
||||
env:
|
||||
PUBLIC_SUPABASE_URL: https://api.portal.monacousa.org
|
||||
PUBLIC_SUPABASE_ANON_KEY: placeholder
|
||||
SUPABASE_SERVICE_ROLE_KEY: placeholder
|
||||
|
||||
- name: Build Docker image
|
||||
run: |
|
||||
docker build -t monacousa-portal:${{ gitea.sha }} \
|
||||
--build-arg PUBLIC_SUPABASE_URL=https://api.portal.monacousa.org \
|
||||
--build-arg PUBLIC_SUPABASE_ANON_KEY=placeholder \
|
||||
--build-arg SUPABASE_SERVICE_ROLE_KEY=placeholder \
|
||||
.
|
||||
|
||||
- name: Test container starts
|
||||
run: |
|
||||
docker run -d --name test-portal \
|
||||
-e PUBLIC_SUPABASE_URL=https://api.portal.monacousa.org \
|
||||
-e PUBLIC_SUPABASE_ANON_KEY=placeholder \
|
||||
monacousa-portal:${{ gitea.sha }}
|
||||
sleep 5
|
||||
docker logs test-portal
|
||||
docker stop test-portal
|
||||
docker rm test-portal
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
build-args: |
|
||||
PUBLIC_SUPABASE_URL=https://api.portal.monacousa.org
|
||||
PUBLIC_SUPABASE_ANON_KEY=placeholder
|
||||
SUPABASE_SERVICE_ROLE_KEY=placeholder
|
||||
|
|
|
|||
|
|
@ -1,50 +1,59 @@
|
|||
name: Build and Deploy
|
||||
name: Build and Push Docker Image
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- master
|
||||
tags:
|
||||
- 'v*'
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
- master
|
||||
|
||||
env:
|
||||
REGISTRY: code.letsbe.solutions
|
||||
IMAGE_NAME: letsbe/monacousa-portal
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Log in to Gitea Container Registry
|
||||
if: github.event_name != 'pull_request'
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
node-version: '20'
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ gitea.actor }}
|
||||
password: ${{ secrets.REGISTRY_TOKEN }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci --legacy-peer-deps
|
||||
- name: Extract metadata (tags, labels)
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
tags: |
|
||||
type=ref,event=branch
|
||||
type=ref,event=pr
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
type=raw,value=latest,enable={{is_default_branch}}
|
||||
|
||||
- name: Build
|
||||
run: npm run build
|
||||
env:
|
||||
PUBLIC_SUPABASE_URL: https://api.portal.monacousa.org
|
||||
PUBLIC_SUPABASE_ANON_KEY: placeholder
|
||||
SUPABASE_SERVICE_ROLE_KEY: placeholder
|
||||
|
||||
- name: Build Docker image
|
||||
run: |
|
||||
docker build -t monacousa-portal:${{ gitea.sha }} \
|
||||
--build-arg PUBLIC_SUPABASE_URL=https://api.portal.monacousa.org \
|
||||
--build-arg PUBLIC_SUPABASE_ANON_KEY=placeholder \
|
||||
--build-arg SUPABASE_SERVICE_ROLE_KEY=placeholder \
|
||||
.
|
||||
|
||||
- name: Test container starts
|
||||
run: |
|
||||
docker run -d --name test-portal \
|
||||
-e PUBLIC_SUPABASE_URL=https://api.portal.monacousa.org \
|
||||
-e PUBLIC_SUPABASE_ANON_KEY=placeholder \
|
||||
monacousa-portal:${{ gitea.sha }}
|
||||
sleep 5
|
||||
docker logs test-portal
|
||||
docker stop test-portal
|
||||
docker rm test-portal
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
build-args: |
|
||||
PUBLIC_SUPABASE_URL=https://api.portal.monacousa.org
|
||||
PUBLIC_SUPABASE_ANON_KEY=placeholder
|
||||
SUPABASE_SERVICE_ROLE_KEY=placeholder
|
||||
|
|
|
|||
Loading…
Reference in New Issue