57 lines
1.6 KiB
YAML
57 lines
1.6 KiB
YAML
name: App Image CI
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
|
|
|
|
jobs:
|
|
build_app_image:
|
|
name: Build app image
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
GH_REGISTRY: git.sanin.dev
|
|
IMAGE_NAME: ${{ github.repository }}
|
|
REPOSITORY: ${{ github.event.repository.name }}
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: https://github.com/actions/checkout@v4
|
|
|
|
- name: Set up Docker Buildx
|
|
id: buildx
|
|
uses: https://github.com/docker/setup-buildx-action@v3
|
|
with:
|
|
install: true
|
|
|
|
- name: Login to GitHub Container Registry
|
|
uses: https://github.com/docker/login-action@v3
|
|
with:
|
|
registry: ${{ env.GH_REGISTRY }}
|
|
username: ${{ github.repository_owner }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Extract metadata for Docker image
|
|
if: "!startsWith(github.ref, 'refs/tags/v')"
|
|
id: meta
|
|
uses: https://github.com/docker/metadata-action@v5
|
|
with:
|
|
images: |
|
|
${{ env.GH_REGISTRY }}/${{ env.IMAGE_NAME }}
|
|
tags: |
|
|
type=ref,event=branch
|
|
|
|
- name: Build and push develop Docker image
|
|
uses: https://github.com/docker/build-push-action@v6
|
|
with:
|
|
target: deploy
|
|
push: true
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
platforms: linux/amd64
|
|
cache-from: type=gha,scope=${{ github.workflow }}
|
|
cache-to: type=gha,mode=max,scope=${{ github.workflow }} |