121 lines
4.3 KiB
YAML
121 lines
4.3 KiB
YAML
# https://www.springcloud.io/post/2022-08/springcloud-github-actions
|
|
# good reference
|
|
|
|
|
|
name: Maven Package
|
|
|
|
on:
|
|
# Triggers the workflow on push request events but only for the main branch
|
|
push:
|
|
branches: [ main ]
|
|
# tags: # tags 更新时触发 workflow
|
|
# - 'v*'
|
|
# when merged from branches to master will triger the action
|
|
pull_request:
|
|
branches: [ main ]
|
|
# manually run this workflow from the Actions tab
|
|
workflow_dispatch:
|
|
|
|
|
|
jobs:
|
|
build-and-deploy:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Set up JDK 11
|
|
uses: actions/setup-java@v3
|
|
with:
|
|
java-version: '11'
|
|
distribution: 'temurin'
|
|
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
|
|
settings-path: ${{ github.workspace }} # location for the settings.xml file
|
|
cache: maven
|
|
|
|
- name: Docker Setup QEMU
|
|
# You may pin to the exact commit or the version.
|
|
# uses: docker/setup-qemu-action@e81a89b1732b9c48d79cd809d8d81d79c4647a18
|
|
uses: docker/setup-qemu-action@v2.1.0
|
|
with:
|
|
# QEMU static binaries Docker image (e.g. tonistiigi/binfmt:latest)
|
|
image: # optional, default is tonistiigi/binfmt:latest
|
|
# Platforms to install (e.g. arm64,riscv64,arm)
|
|
platforms: amd64,arm64
|
|
|
|
- name: Docker Setup Buildx
|
|
# You may pin to the exact commit or the version.
|
|
# uses: docker/setup-buildx-action@8c0edbc76e98fa90f69d9a2c020dcb50019dc325
|
|
uses: docker/setup-buildx-action@v2.2.1
|
|
|
|
- name: Docker Login
|
|
# You may pin to the exact commit or the version.
|
|
# uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
|
|
uses: docker/login-action@v2.1.0
|
|
with:
|
|
# Username used to log against the Docker registry
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
# Password or personal access token used to log against the Docker registry
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
# optional, default is true
|
|
logout: true
|
|
|
|
|
|
- name: Build My Base Image
|
|
uses: docker/build-push-action@v3.2.0
|
|
with:
|
|
context: ./
|
|
# Path to the Dockerfile
|
|
file: ./localEnvironment/src/main/java/io/wdd/localenviroment/build-my-own-base-image.dockerfile
|
|
platforms: linux/amd64,,linux/arm64
|
|
push: true
|
|
tags: eclipse-temurin-11-jre-focal:2022-11-22
|
|
|
|
# - name: Build Maven
|
|
# run: |
|
|
# mvn -B -DskipTests=true package --file pom.xml
|
|
# ls
|
|
# echo "--------------------------------------"
|
|
# pwd
|
|
# echo "--------------------------------------"
|
|
# cd ./server/target
|
|
# ls
|
|
# cd /home/runner/work/ProjectOctopus/ProjectOctopus
|
|
# echo "--------------------------------------"
|
|
# cd ./agent/target
|
|
# ls
|
|
# cd /home/runner/work/ProjectOctopus/ProjectOctopus
|
|
# echo "--------------------------------------"
|
|
# cat /proc/cpuinfo
|
|
# echo "--------------------------------------"
|
|
#
|
|
# - name: Build and push Docker images
|
|
# # You may pin to the exact commit or the version.
|
|
# # uses: docker/build-push-action@c56af957549030174b10d6867f20e78cfd7debc5
|
|
# uses: docker/build-push-action@v3.2.0
|
|
# with:
|
|
# context: # optional
|
|
# # Path to the Dockerfile
|
|
# file: # optional
|
|
# # List of metadata for an image
|
|
# labels: # optional
|
|
# # Load is a shorthand for --output=type=docker
|
|
# load: # optional, default is false
|
|
# # Set the networking mode for the RUN instructions during build
|
|
# network: # optional
|
|
# # Do not use cache when building the image
|
|
# no-cache: # optional, default is false
|
|
# # Do not cache specified stages
|
|
# no-cache-filters: # optional
|
|
# # List of output destinations (format: type=local,dest=path)
|
|
# outputs: # optional
|
|
# # List of target platforms for build
|
|
# platforms: linux/amd64,,linux/arm64
|
|
# # Always attempt to pull all referenced images
|
|
# pull: # optional, default is false
|
|
# # Push is a shorthand for --output=type=registry
|
|
# push: # optional, default is false
|
|
|
|
|
|
|