Skip to content

changed target (#11) #2

changed target (#11)

changed target (#11) #2

Workflow file for this run

name: CD Pipeline
on:
workflow_dispatch:
push:
branches:
- main
env:
IMAGE_NAME: portfolio23-image
REGISTRY: ghcr.io
jobs:
build-and-push:
runs-on: ubuntu-latest
environment: production
permissions:
contents: read
packages: write
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Convert repository name to lowercase
run: echo "REPO_NAME=$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v3
with:
images: ${{ env.REGISTRY }}/${{env.REPO_NAME}}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
target: release # Target the prod build target in the Dockerfile
- name: Deploy Image to CapRover
uses: caprover/[email protected]
with:
server: "${{ secrets.CAP_SERVER_URL }}"
app: "${{ secrets.CAP_APP_NAME }}"
token: "${{ secrets.CAP_APP_TOKEN }}"
image: ${{ env.REGISTRY }}/${{env.REPO_NAME}}/${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.version }}