Skip to content

Exercise4: Testing pipeline #1

Exercise4: Testing pipeline

Exercise4: Testing pipeline #1

name: Build and Push Docker image to Github Registry
on:
pull_request:
types: [closed]
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Push Docker image to Github Registry after merge
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ghcr.io/${{ github.repository_owner }}/taskman:latest
if: github.event.pull_request.merged == true