2023-11-12 15:18:38 +08:00
|
|
|
# This workflow will build a Java project with Maven
|
|
|
|
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
|
|
|
|
|
|
|
|
name: PIG 镜像 action
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
2024-03-02 18:05:38 +08:00
|
|
|
branches: [ jdk17 ]
|
2023-11-12 15:18:38 +08:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
java-version: [ 17 ]
|
|
|
|
steps:
|
2024-03-03 14:12:15 +08:00
|
|
|
- uses: actions/checkout@v4
|
2023-11-12 15:18:38 +08:00
|
|
|
- name: Set up JDK ${{ matrix.java-version }}
|
2024-03-03 14:12:18 +08:00
|
|
|
uses: actions/setup-java@v4
|
2023-11-12 15:18:38 +08:00
|
|
|
with:
|
|
|
|
java-version: ${{ matrix.java-version }}
|
|
|
|
distribution: 'zulu'
|
|
|
|
|
|
|
|
- name: mvn clean install
|
2024-04-17 13:39:12 +08:00
|
|
|
run: mvn clean install -Pcloud
|
2023-11-12 15:18:38 +08:00
|
|
|
|
|
|
|
- name: Login to Docker Registry
|
|
|
|
run: docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} registry.cn-hangzhou.aliyuncs.com
|
|
|
|
|
|
|
|
- name: Build and push Docker images
|
|
|
|
run: |
|
|
|
|
docker-compose build
|
|
|
|
registry="registry.cn-hangzhou.aliyuncs.com/pigx/"
|
|
|
|
for service in $(docker-compose config --services); do
|
|
|
|
if [ "$service" != "pig-redis" ]; then
|
|
|
|
docker tag ${service}:latest ${registry}${service}:latest
|
|
|
|
docker push ${registry}${service}:latest
|
|
|
|
else
|
|
|
|
echo "Skipping pig-redis service"
|
|
|
|
fi
|
|
|
|
done
|