Skip to content

Build(package): 🏗️ 更新包依赖 #294

Build(package): 🏗️ 更新包依赖

Build(package): 🏗️ 更新包依赖 #294

name: Publish Latest Package
on:
workflow_dispatch: {}
push:
paths-ignore:
- 'docs/**'
- '.github/**'
- '**.md'
- '**.png'
- '**.json'
branches: [master]
tags: ["*"]
jobs:
build:
runs-on: ubuntu-latest
name: Publish Latest Package job
if: startsWith(github.repository, 'qd-today/qd') # 仓库名
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ secrets.DOCKER_USERNAME }} # dockerServer Username 在setting创建secrets name=DOCKER_USERNAME value=dockerid
password: ${{ secrets.GITHUB_TOKEN }} # dockerServer Token
- name: login to qdtoday DockerHub
uses: docker/login-action@v2
with:
registry: docker.io
username: ${{ secrets.QD_DOCKER_USERNAME }} # dockerServer Username 在setting创建secrets name=QD_DOCKER_USERNAME value=dockerid
password: ${{ secrets.QD_DOCKER_PASSWORD }} # dockerServer Token 在setting创建secrets name=QD_DOCKER_PASSWORD value=dockerToken
- name: Publish Latest Package
uses: docker/build-push-action@v4
if: github.ref == 'refs/heads/master'
with:
context: .
file: ./Dockerfile
platforms: linux/386,linux/arm64,linux/amd64,linux/arm/v6,linux/arm/v7 # 你准备构建的镜像平台
push: true
tags: ghcr.io/qd-today/qd:latest,docker.io/qdtoday/qd:dev
- name: Login to a76yyyy DockerHub
uses: docker/login-action@v2
if: github.ref == 'refs/heads/master'
with:
registry: docker.io
username: ${{ secrets.DOCKER_USERNAME }} # dockerServer Username 在setting创建secrets name=DOCKER_USERNAME value=dockerid
password: ${{ secrets.DOCKER_PASSWORD }} # dockerServer Token 在setting创建secrets name=DOCKER_PASSWORD value=dockerToken
- name: Push image to a76yyyy DockerHub
if: github.ref == 'refs/heads/master'
run: |
docker buildx imagetools create \
--tag docker.io/a76yyyy/qiandao:dev \
docker.io/qdtoday/qd:dev
- name: Get version
id: get_version
if: startsWith(github.ref, 'refs/tags/')
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- name: Build Latest Package
uses: docker/build-push-action@v4
if: startsWith(github.ref, 'refs/tags/')
with:
context: .
file: ./Dockerfile
platforms: linux/386,linux/arm64,linux/amd64,linux/arm/v6,linux/arm/v7 # 你准备构建的镜像平台
push: true
tags: docker.io/qdtoday/qd:latest,docker.io/qdtoday/qd:${{ steps.get_version.outputs.VERSION }}
- name: Login to a76yyyy DockerHub
uses: docker/login-action@v2
if: startsWith(github.ref, 'refs/tags/')
with:
registry: docker.io
username: ${{ secrets.DOCKER_USERNAME }} # dockerServer Username 在setting创建secrets name=DOCKER_USERNAME value=dockerid
password: ${{ secrets.DOCKER_PASSWORD }} # dockerServer Token 在setting创建secrets name=DOCKER_PASSWORD value=dockerToken
- name: Push image to a76yyyy DockerHub
if: startsWith(github.ref, 'refs/tags/')
run: |
docker buildx imagetools create \
--tag docker.io/a76yyyy/qiandao:latest \
--tag docker.io/a76yyyy/qiandao:${{ steps.get_version.outputs.VERSION }} \
docker.io/qdtoday/qd:${{ steps.get_version.outputs.VERSION }}