[maven-release-plugin] prepare for next development iteration #45
This file contains 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: Build | |
on: | |
push: | |
branches: | |
- master | |
paths: | |
- .github/** | |
- src/** | |
- conf/** | |
- Dockerfile | |
- pom.xml | |
pull_request: | |
branches: | |
- master | |
paths: | |
- .github/** | |
- src/** | |
- conf/** | |
- Dockerfile | |
- pom.xml | |
env: | |
REGISTRY: europe-north1-docker.pkg.dev/artifact-registry-5n/dapla-pseudo-docker/ssb/dapla | |
IMAGE: dapla-dlp-pseudo-service | |
TAG: ${{ github.ref_name }}-${{ github.sha }} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
id-token: write | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 21 | |
distribution: zulu | |
cache: maven | |
- name: Authenticate to Google Cloud | |
id: auth | |
uses: google-github-actions/auth@v1.1.1 | |
with: | |
workload_identity_provider: "projects/848539402404/locations/global/workloadIdentityPools/gh-actions/providers/gh-actions" | |
service_account: "gh-actions-dapla-pseudo@artifact-registry-5n.iam.gserviceaccount.com" | |
token_format: access_token | |
- name: Build with Maven and deploy to Artifact Registry | |
run: mvn --batch-mode -P ssb-bip deploy | |
- name: Clean up artifacts that are no longer needed | |
run: | | |
rm -f target/dapla-dlp-pseudo-service-*-sources.jar | |
rm -f target/dapla-dlp-pseudo-service-*-javadoc.jar | |
ls -al target/dapla-dlp-pseudo-service-*.jar | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to Artifact Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: "oauth2accesstoken" | |
password: "${{ steps.auth.outputs.access_token }}" | |
- name: Docker meta | |
id: metadata | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE }} | |
# Docker tags based on the following events/attributes | |
tags: | | |
type=ref,event=branch | |
type=ref,event=pr,suffix=-${{ github.event.pull_request.head.sha }} | |
type=raw,value=latest,enable={{is_default_branch}} | |
type=raw,value={{branch}}-{{sha}},enable={{is_default_branch}} | |
type=semver,pattern=v{{version}} | |
type=semver,pattern=v{{major}}.{{minor}} | |
type=semver,pattern=v{{major}} | |
- name: Build and push | |
id: docker_build | |
uses: docker/build-push-action@v4 | |
with: | |
file: Dockerfile | |
push: true | |
context: . | |
tags: | | |
${{ steps.metadata.outputs.tags }} | |
labels: ${{ steps.metadata.outputs.labels }} | |
- name: Image digest | |
run: echo ${{ steps.docker_build.outputs.digest }} |