Merge pull request #3331 from ControlSystemStudio/CSSTUDIO-2989 #3
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: Alarm Logger Docker Image CI | |
| on: | |
| push: | |
| branches: [ "master" ] | |
| paths: services/alarm-logger/** | |
| tags: | |
| - '**' | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE_NAME: ${{ github.repository }}/service-alarm-logger | |
| jobs: | |
| build-server: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Maven and Java Action | |
| uses: s4u/[email protected] | |
| with: | |
| java-version: '17' | |
| maven-version: '3.9.6' | |
| - name: Build | |
| run: mvn --batch-mode install -DskipTests | |
| build-and-push-image: | |
| permissions: | |
| contents: read | |
| packages: write | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '17' | |
| distribution: 'temurin' | |
| cache: maven | |
| - name: Build with Maven | |
| run: mvn --batch-mode --update-snapshots package | |
| - name: Login to the registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract meta-data for Docker | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
| - name: Set up Docker Build | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build and publish the Docker image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: services/alarm-logger | |
| push: true | |
| platforms: linux/amd64 | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max |