Project CI/CD Build Flow #18
This file contains hidden or 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
| # This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time | |
| # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven | |
| # This workflow uses actions that are not certified by GitHub. | |
| # They are provided by a third-party and are governed by | |
| # separate terms of service, privacy policy, and support | |
| # documentation. | |
| name: Project CI/CD Build Flow | |
| on: | |
| [workflow_dispatch] | |
| # push: | |
| # branches: ["main"] | |
| # pull_request: | |
| # branches: ["main"] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: "21" | |
| distribution: "temurin" | |
| cache: maven | |
| - name: Build insta-service-registry with Maven | |
| run: | | |
| cd insta-service-registry | |
| mvn clean package -DskipTests | |
| cd ../insta-config-server | |
| mvn clean package -DskipTests | |
| cd ../insta-gateway-service | |
| mvn clean package -DskipTests | |
| cd ../idea-link-service | |
| mvn clean package -DskipTests | |
| # deploy: | |
| # runs-on: ubuntu-latest | |
| # needs: build | |
| # steps: | |
| # - name: Checkout Repository | |
| # uses: actions/checkout@v4 | |
| - name: Install Pack CLI | |
| uses: buildpacks/github-actions/[email protected] | |
| - name: Log in to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: leezonghan19 | |
| password: Siv170013! # Use DOCKER_ACCESS_TOKEN instead if applicable | |
| - name: Build and Push Docker Images | |
| run: | | |
| cd insta-service-registry | |
| pack build leezonghan19/insta-service-registry:latest \ | |
| --builder paketobuildpacks/builder-jammy-tiny \ | |
| --path target/*.jar \ | |
| --publish | |
| cd ../insta-config-server | |
| pack build leezonghan19/insta-config-server:latest \ | |
| --builder paketobuildpacks/builder-jammy-tiny \ | |
| --path target/*.jar \ | |
| --publish | |
| cd ../insta-gateway-service | |
| pack build leezonghan19/insta-gateway-service:latest \ | |
| --builder paketobuildpacks/builder-jammy-tiny \ | |
| --path target/*.jar \ | |
| --publish | |
| cd ../idea-link-service | |
| pack build leezonghan19/idea-link-service:latest \ | |
| --builder paketobuildpacks/builder-jammy-tiny \ | |
| --path target/*.jar \ | |
| --publish | |
| # Optional: Uploads the full dependency graph to GitHub to improve the quality of Dependabot alerts this repository can receive | |
| - name: Submit Dependency Snapshot | |
| uses: advanced-security/maven-dependency-submission-action@v4 |