build: 更新 action
This commit is contained in:
parent
71d11f0fb7
commit
9e4082720e
|
@ -4,13 +4,12 @@ on:
|
|||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
build_push:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
name: Build Docker Image and Push
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: nelonoel/branch-name@v1.0.1
|
||||
|
||||
- name: Cache node modules
|
||||
uses: actions/cache@v2
|
||||
env:
|
||||
|
@ -23,17 +22,13 @@ jobs:
|
|||
${{ runner.os }}-build-
|
||||
${{ runner.os }}-
|
||||
|
||||
- name: Cache maven dependencies
|
||||
- name: Cache local Maven repository
|
||||
uses: actions/cache@v2
|
||||
env:
|
||||
cache-name: cache-maven-deps
|
||||
with:
|
||||
path: ~/.m2
|
||||
key: ${{ runner.os }}-build-${{ env.cache-name }}
|
||||
path: ~/.m2/repository
|
||||
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-build-${{ env.cache-name }}
|
||||
${{ runner.os }}-build-
|
||||
${{ runner.os }}-
|
||||
${{ runner.os }}-maven-
|
||||
|
||||
- name: Set up JDK 1.8
|
||||
uses: actions/setup-java@v1
|
||||
|
@ -45,17 +40,11 @@ jobs:
|
|||
- name: Build with Maven
|
||||
run: mvn -B package --file pom.xml
|
||||
|
||||
- name: Docker Setup Buildx
|
||||
uses: docker/setup-buildx-action@v1.0.3
|
||||
|
||||
- name: Docker Login
|
||||
uses: docker/login-action@v1.6.0
|
||||
- name: Push to Docker Hub
|
||||
uses: docker/build-push-action@v1
|
||||
with:
|
||||
username: metersphere
|
||||
password: ${{ secrets.DOCKER_HUB_TOKEN }}
|
||||
|
||||
- name: Build Docker Image
|
||||
uses: docker/build-push-action@v2.2.0
|
||||
with:
|
||||
build-args: MS_VERSION=${{ env.BRANCH_NAME }}-b${{ env.GITHUB_RUN_NUMBER }}
|
||||
tags: metersphere/metersphere:${{ env.BRANCH_NAME }}
|
||||
repository: metersphere/metersphere
|
||||
tag_with_ref: true
|
||||
tag_with_sha: true
|
||||
|
|
Loading…
Reference in New Issue