-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
071dee0
commit 8aa7c2a
Showing
1 changed file
with
58 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
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: 'graalvm' | ||
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,linux/arm | ||
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 }} |