Skip to content

Commit

Permalink
feat(ci): add image push
Browse files Browse the repository at this point in the history
  • Loading branch information
punchanabu committed Oct 23, 2024
1 parent d10299c commit be6b3fa
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: CI

on:
push:
branches:
- dev
- main
tags:
- v*

env:
IMAGE_NAME: ghcr.io/${{ github.repository }}

permissions:
contents: read
packages: write

jobs:
build-and-push:
name: Build and push docker image
runs-on: ubuntu-latest

steps:
- name: Login to registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}

- name: Setup buildx
uses: docker/setup-buildx-action@v2

- name: Build and push
uses: docker/build-push-action@v3
with:
push: true
tags: ${{ env.IMAGE_NAME }}:${{ github.ref_type == 'tag' && github.ref_name || github.sha }}
cache-from: type=gha,ref=${{ env.IMAGE_NAME }}:buildcache
cache-to: type=gha,ref=${{ env.IMAGE_NAME }}:buildcache,mode=max

0 comments on commit be6b3fa

Please sign in to comment.