未验证 提交 4ffbd502 编写于 作者: J John Niang 提交者: GitHub

Refactor docker release in GitHub workflow (#1510)

Signed-off-by: NJohn Niang <johnniang@fastmail.com>
上级 6be4051f
......@@ -3,14 +3,14 @@ name: Halo CI
on:
pull_request:
paths:
- '**'
- '!**.md'
- "**"
- "!**.md"
push:
branches:
- '**'
- "**"
paths:
- '**'
- '!**.md'
- "**"
- "!**.md"
release:
types: # This configuration does not affect the page_build event above
- created
......@@ -109,45 +109,46 @@ jobs:
- uses: actions/checkout@v2
with:
submodules: true
- name: Set up JDK 11
uses: actions/setup-java@v2
- name: Download halo jar
uses: actions/download-artifact@v2
with:
distribution: 'temurin'
cache: 'gradle'
java-version: 11
- name: Get version of halo
id: get_halo_version
run: |
version=$(./gradlew -q projectVersion)
echo "Trying to build and publish halo:${version}"
echo "HALO_VERSION=${version}" >> $GITHUB_ENV
name: halo-jar
path: build/libs
- name: Docker meta for Halo
id: meta
uses: docker/metadata-action@v3
with:
images: |
halohub/halo
ghcr.io/${{ github.repository_owner }}/halo
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{ version }}
type=semver,pattern={{major}}.{{minor}}
type=sha
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Login to DockerHub
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
-
name: Build and push with version tag
uses: docker/build-push-action@v2
- name: Login to GHCR
uses: docker/login-action@v1
with:
context: .
file: ./Dockerfile
platforms: ${{ secrets.DOCKER_PLATFORMS }}
push: true
tags: |
${{ secrets.DOCKER_IMAGE_NAME }}:${{ env.HALO_VERSION}}
- name: Build and push with latest tag
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GHCR_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v2
if: "!github.event.release.prerelease"
with:
context: .
file: ./Dockerfile
platforms: ${{ secrets.DOCKER_PLATFORMS }}
platforms: linux/amd64,linux/arm/v7,linux/arm64
labels: ${{ steps.meta.outputs.labels }}
tags: ${{ steps.meta.outputs.tags }}
push: true
tags: |
${{ secrets.DOCKER_IMAGE_NAME }}:latest
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册