Merge pull request #37 from com-pas/30-security-policy #2
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
# SPDX-FileCopyrightText: 2023 Alliander N.V. | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
on: | ||
push: | ||
branches: | ||
- main | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
name: release-please | ||
jobs: | ||
release_please: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
release_created: ${{ steps.release.outputs.release_created }} | ||
steps: | ||
- uses: google-github-actions/release-please-action@v3 | ||
id: release | ||
with: | ||
release-type: maven | ||
package-name: compas-sitipe-service | ||
# The logic below handles the docker hub publication: | ||
push_to_registry: | ||
needs: release_please | ||
if: needs.release_please.outputs.release_created == "true" | ||
Check failure on line 29 in .github/workflows/release-please.yml GitHub Actions / release-pleaseInvalid workflow file
|
||
name: Build and publish | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 15 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Cache Docker Register | ||
uses: actions/cache@v3 | ||
with: | ||
path: /tmp/.buildx-cache | ||
key: ${{ runner.os }}-buildx-${{ hashFiles('**/Dockerfile') }} | ||
- name: Cache Maven packages | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.m2 | ||
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | ||
restore-keys: ${{ runner.os }}-m2 | ||
- name: Extract tag name | ||
id: extract_tagname | ||
shell: bash | ||
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: 'zulu' | ||
java-version: '17' | ||
- name: Set up Docker Buildx | ||
id: buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- name: Login to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKER_HUB_USERNAME }} | ||
password: ${{ secrets.DOCKER_HUB_TOKEN }} | ||
- name: Create custom Maven Settings.xml | ||
uses: whelk-io/maven-settings-xml-action@v21 | ||
with: | ||
output_file: custom_maven_settings.xml | ||
servers: '[{ "id": "github-packages-compas", "username": "OWNER", "password": "${{ secrets.GITHUB_TOKEN }}" }]' | ||
- name: Set version with Maven | ||
run: ./mvnw -B versions:set -DprocessAllModules=true -DnewVersion=${{ env.RELEASE_VERSION }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Deploy with Maven to GitHub Packages and Docker Hub | ||
run: ./mvnw -B -s custom_maven_settings.xml -Pnative-image,release clean deploy | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |