Skip to content

优化:自动构建Docker镜像并推送至GHCR #1

优化:自动构建Docker镜像并推送至GHCR

优化:自动构建Docker镜像并推送至GHCR #1

Workflow file for this run

name: Build and Push Docker Image

Check failure on line 1 in .github/workflows/push-to-ghcr.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/push-to-ghcr.yml

Invalid workflow file

(Line: 13, Col: 3): The workflow must contain at least one job with no dependencies.
on:
push:
branches:
- '**'
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}/stapxs-qq-lite
jobs:
build-and-push:
runs-on: ubuntu-latest
needs: release
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@cb17bfb94d170dac063a73d4d1d8c6e9276a7dd0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@4d1504c5a9df8bec08ef65c7a59d5fc4b25ab529
- name: Log into registry ${{ env.REGISTRY }}
uses: docker/login-action@2064b455456ba96d99e9abbb305f489bac30bfd5
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@032a4b3bda1b716928481836ac5bfe36e1feaad6
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha,prefix={{branch}}-
- name: Build and push Docker image
uses: docker/build-push-action@9e436ba9f2d7bcd1d038c8e55d039d37896ddc5d
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max