Skip to content

Commit

Permalink
CI: Implement a publish action to push Docker images
Browse files Browse the repository at this point in the history
Signed-off-by: HarshCasper <[email protected]>
  • Loading branch information
HarshCasper committed Mar 2, 2022
1 parent 4450908 commit 355b058
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 2 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
name: Continuous Integration

on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
workflow_dispatch:
Expand Down
51 changes: 51 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Taswira CD

on:
schedule:
- cron: "0 0 * * MON"

push:
branches: [ master ]
# Publish semver tags as releases.
tags: [ 'v*.*.*' ]

env:
REGISTRY: ghcr.io

jobs:
build:
name: Build and publish Taswira
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Log into GitHub Container Registry
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ env.REGISTRY }}/moja-global/taswira

- name: Build and push Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max

0 comments on commit 355b058

Please sign in to comment.