CI / Deploy to GHCR #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI / Deploy | |
on: | |
push: | |
tags: | |
- '*' | |
workflow_dispatch: | |
env: | |
USERNAME: ${{ github.repository_owner }} | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
PASSWORD: ${{ secrets.GITHUB_TOKEN }} | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
name: Deploy | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to the Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ env.USERNAME }} | |
password: ${{ env.PASSWORD }} | |
- name: Extract Metadata for Docker | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
tags: | | |
type=ref,event=pr | |
type=edge | |
latest | |
${{ github.ref_name }} | |
labels: | | |
org.opencontainers.image.title=auto-contributions | |
org.opencontainers.image.description=Github Action that generates the Contributions, Coding Style, Most Used Languages of a Github User in SVG Format. | |
org.opencontainers.image.vendor=Vedansh | |
- name: Verify Tags and Labels | |
run: | | |
echo "## Github Action Summary - Docker CI " >> $GITHUB_STEP_SUMMARY | |
echo "${{ steps.meta.outputs.labels }} " >> $GITHUB_STEP_SUMMARY | |
echo "*** VERIFICATION COMPLETED *** " | |
- name: Build and Push Image | |
id: build-and-push | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
platforms: linux/amd64,linux/arm64,linux/arm/v7 |