Merge pull request #31 from tongpu/chore/add_full_apache_license #141
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
| name: Continuous Integration | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| permissions: | |
| packages: write | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| packages: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-java@v4 | |
| with: | |
| java-version: '21' | |
| distribution: 'temurin' | |
| cache: 'maven' | |
| - name: Run the Maven verify phase | |
| run: mvn --batch-mode --update-snapshots verify | |
| # For pull requests we create a container image and if it is not from a fork, we push it to the | |
| # GitHub Container Registry ghcr.io as a preview image with the tag name 'pr{pull request number}'. | |
| - name: Login to GitHub Container Registry | |
| if: github.event_name == 'pull_request' && !github.event.pull_request.head.repo.fork | |
| run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin | |
| - name: Create container image | |
| if: github.event_name == 'pull_request' | |
| env: | |
| IMAGE_ID: ghcr.io/${{ github.repository }}-preview | |
| VERSION: pr${{ github.event.number }} | |
| run: | | |
| # Convert to lowercase | |
| IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') | |
| echo "Building ${IMAGE_ID}:${VERSION}" | |
| mvn spring-boot:build-image \ | |
| -Dmaven.test.skip=true \ | |
| -Dspring-boot.build-image.imageName=$IMAGE_ID:$VERSION | |
| - name: Upload container image | |
| if: github.event_name == 'pull_request' && !github.event.pull_request.head.repo.fork | |
| env: | |
| IMAGE_ID: ghcr.io/${{ github.repository }}-preview | |
| VERSION: pr${{ github.event.number }} | |
| run: | | |
| # Convert to lowercase | |
| IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') | |
| docker push $IMAGE_ID:$VERSION |