Skip to content

Clipboard (#7)

Clipboard (#7) #8

Workflow file for this run

name: CD Pipeline
on:
workflow_dispatch:
push:
branches:
- main
env:
IMAGE_NAME: poo-image
REGISTRY: ghcr.io
jobs:
build-and-push:
runs-on: ubuntu-latest
environment: production
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 }}
- name: Deploy Image to CapRrover
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 }}