修改构建镜像平台 #5
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build | |
on: | |
push: | |
tags: | |
- v* | |
jobs: | |
docker-release: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
target: | |
- Dockerfile: Dockerfile | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
cache: maven | |
- name: Build with Maven | |
run: mvn -B clean package --file pom.xml | |
- name: Prepare | |
id: prepare | |
run: | | |
TAG=${GITHUB_REF#refs/tags/} | |
echo ::set-output name=full_tag_name::${TAG} | |
echo ::set-output name=latest_tag::latest | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v1 | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@master | |
- name: Login to Docker Hub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and publish ${{ matrix.target.Dockerfile }} | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
push: true | |
builder: ${{ steps.buildx.outputs.name }} | |
file: ${{ matrix.target.Dockerfile }} | |
platforms: linux/amd64,linux/arm64 | |
cache-from: type=gha,scope=${{ github.workflow }} | |
cache-to: type=gha,mode=max,scope=${{ github.workflow }} | |
tags: | | |
zhuweitung/jd-stock:${{ steps.prepare.outputs.full_tag_name }} | |
zhuweitung/jd-stock:${{ steps.prepare.outputs.latest_tag }} |