update workflow

This commit is contained in:
texm
2023-04-25 15:08:04 +08:00
parent 3ad18a2bca
commit 77109c1692

View File

@@ -1,12 +1,11 @@
name: Build & Publish Image name: Create Release & Publish Image
on: on:
release: push:
types: [published] branches:
- 'main'
env: tags:
REGISTRY: ghcr.io - 'v*'
IMAGE_NAME: ${{ github.repository }}
jobs: jobs:
build: build:
@@ -16,7 +15,7 @@ jobs:
packages: write packages: write
steps: steps:
- name: Checkout repository - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Log in to the Container registry - name: Log in to the Container registry
@@ -26,16 +25,19 @@ jobs:
username: ${{ github.actor }} username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }} password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata for Docker - name: Extract Docker metadata
id: meta id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 uses: docker/metadata-action@v4
with: with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} images: ghcr.io/texm/shokku
tags: |
type=ref,event=branch
type=semver,pattern={{raw}}
- name: Build and push Docker image - name: Build and push Docker image
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
with: with:
context: . context: .
push: true push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }} tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }} labels: ${{ steps.meta.outputs.labels }}