Skip to content

Commit d7b456a

Browse files
Update maven.yml
1 parent b6e0e9b commit d7b456a

File tree

1 file changed

+36
-40
lines changed

1 file changed

+36
-40
lines changed

.github/workflows/maven.yml

Lines changed: 36 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ jobs:
1717
steps:
1818
- uses: actions/checkout@v2
1919

20+
- name: Get branch name
21+
id: branch-name
22+
uses: tj-actions/branch-names@v6
23+
2024
- name: Set up JDK 8
2125
uses: actions/setup-java@v2
2226
with:
@@ -36,47 +40,39 @@ jobs:
3640
name: Package
3741
path: staging
3842

39-
build_image:
40-
needs: [build]
41-
runs-on: ubuntu-latest
42-
if: github.event_name == 'push'
43-
steps:
44-
- name: Get branch name
45-
id: branch-name
46-
uses: tj-actions/branch-names@v6
43+
- name: Create environment variable with the commit id
44+
run: |
45+
echo "DOCKER_TAG=${GITHUB_SHA}" >> $GITHUB_ENV
4746
48-
- uses: actions/checkout@v2
49-
50-
- name: Create environment variable with the commit id
51-
run: |
52-
echo "DOCKER_TAG=${GITHUB_SHA}" >> $GITHUB_ENV
53-
- name: Create environment variable with the version id
54-
run: |
55-
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
56-
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
57-
[ "$VERSION" == "master" ] && VERSION=latest
58-
echo "WINGS_VERSION=${VERSION}" >> $GITHUB_ENV
59-
- name: Expose the commit id
60-
id: exposeValue
61-
run: |
62-
echo "::set-output name=docker_tag::${{ env.DOCKER_TAG }}"
63-
- name: Set up QEMU
64-
uses: docker/setup-qemu-action@v2
47+
- name: Create environment variable with the version id
48+
run: |
49+
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
50+
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
51+
[ "$VERSION" == "master" ] && VERSION=latest
52+
echo "WINGS_VERSION=${VERSION}" >> $GITHUB_ENV
53+
54+
- name: Expose the commit id
55+
id: exposeValue
56+
run: |
57+
echo "::set-output name=docker_tag::${{ env.DOCKER_TAG }}"
58+
59+
- name: Set up QEMU
60+
uses: docker/setup-qemu-action@v2
6561

66-
- name: Set up Docker Buildx
67-
uses: docker/setup-buildx-action@v2
62+
- name: Set up Docker Buildx
63+
uses: docker/setup-buildx-action@v2
6864

69-
- name: Login to DockerHub
70-
uses: docker/login-action@v1
71-
with:
72-
username: ${{ secrets.DOCKERHUB_USERNAME }}
73-
password: ${{ secrets.DOCKERHUB_TOKEN }}
65+
- name: Login to DockerHub
66+
uses: docker/login-action@v1
67+
with:
68+
username: ${{ secrets.DOCKERHUB_USERNAME }}
69+
password: ${{ secrets.DOCKERHUB_TOKEN }}
7470

75-
- name: Build and push Docker image
76-
uses: docker/build-push-action@v3.0.0
77-
with:
78-
push: true
79-
context: .
80-
tags: ${{ env.DOCKER_IMAGE_REPOSITORY }}/${{ env.DOCKER_IMAGE_NAME }}:latest, ${{ env.DOCKER_IMAGE_REPOSITORY }}/${{ env.DOCKER_IMAGE_NAME }}:${{ env.DOCKER_TAG }}, ${{ env.DOCKER_IMAGE_REPOSITORY }}/${{ env.DOCKER_IMAGE_NAME }}:${{ env.WINGS_VERSION }}
81-
file: ${{ env.DOCKER_FILE}}
82-
platforms: linux/amd64,linux/arm64
71+
- name: Build and push Docker image
72+
uses: docker/build-push-action@v3.0.0
73+
with:
74+
push: true
75+
context: .
76+
tags: ${{ env.DOCKER_IMAGE_REPOSITORY }}/${{ env.DOCKER_IMAGE_NAME }}:latest, ${{ env.DOCKER_IMAGE_REPOSITORY }}/${{ env.DOCKER_IMAGE_NAME }}:${{ env.DOCKER_TAG }}, ${{ env.DOCKER_IMAGE_REPOSITORY }}/${{ env.DOCKER_IMAGE_NAME }}:${{ env.WINGS_VERSION }}
77+
file: ${{ env.DOCKER_FILE}}
78+
platforms: linux/amd64,linux/arm64

0 commit comments

Comments
 (0)