Merge remote-tracking branch 'origin/master' #17
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: Create Release | |
on: | |
push: | |
branches: | |
- 'release-*' | |
env: | |
REGISTRY: ghcr.io | |
ALTERNATE_REGISTRY: ${{ secrets.DOCKER_REGISTRY }} | |
IMAGE_NAME: ${{ github.repository }} | |
SONAR_URL: https://sonarcloud.io | |
SONAR_ORG: grrolland-github | |
SONAR_PROJECT_KEY: grrolland_ngx-distributed-shm | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get tag name | |
id: get_tag_name | |
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/heads\/release-/} | |
## | |
# Perform Maven Release | |
# | |
- uses: actions/checkout@v4 | |
with: | |
ref: master | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'adopt' | |
cache: maven | |
- name: Configure Git user | |
run: | | |
git config user.email "actions@github.com" | |
git config user.name "GitHub Actions" | |
- name: Perform Release | |
run: mvn -B -Dtag=${GITHUB_REF##*release-} release:prepare release:perform | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
## | |
# Checkout and Build the Tag | |
# | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ steps.get_tag_name.outputs.VERSION }} | |
- name: Build Tag | |
run: | | |
mvn clean \ | |
org.jacoco:jacoco-maven-plugin:prepare-agent \ | |
package \ | |
org.jacoco:jacoco-maven-plugin:report \ | |
sonar:sonar \ | |
-B -e -V \ | |
-Dsonar.host.url=$SONAR_URL \ | |
-Dsonar.token=$SONAR_TOKEN \ | |
-Dsonar.organization=$SONAR_ORG \ | |
-Dsonar.projectKey=$SONAR_PROJECT_KEY \ | |
-Dsonar.sources=src/main \ | |
-Dsonar.junit.reportPaths=target/surefire-reports \ | |
-Dsonar.coverage.jacoco.xmlReportPaths=target/site/jacoco/jacoco.xml | |
env: | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
## | |
# Publish to Github Docker Registry | |
# | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
tags: | | |
${{ steps.get_tag_name.outputs.VERSION }} | |
latest | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
## | |
# Publish to Alternate Docker Registry | |
# | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.ALTERNATE_REGISTRY }} | |
username: ${{ secrets.DOCKER_REGISTRY_USERNAME }} | |
password: ${{ secrets.DOCKER_REGISTRY_PASSWORD }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta_alt | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.ALTERNATE_REGISTRY }}/${{ env.IMAGE_NAME }} | |
tags: | | |
${{ steps.get_tag_name.outputs.VERSION }} | |
latest | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: true | |
tags: ${{ steps.meta_alt.outputs.tags }} | |
labels: ${{ steps.meta_alt.outputs.labels }} | |
## | |
# Create a Github Release | |
# | |
- uses: ncipollo/release-action@v1 | |
with: | |
body: Release version ${{ steps.get_tag_name.outputs.VERSION }} | |
tag: ${{ steps.get_tag_name.outputs.VERSION }} | |
token: ${{ secrets.GITHUB_TOKEN }} |