-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #90 from MrSebastian/try-new-mvn-release
mvn release
- Loading branch information
Showing
8 changed files
with
280 additions
and
79 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
name: callable build ghcr image from tag | ||
on: | ||
workflow_call: | ||
inputs: | ||
tag: | ||
required: true | ||
type: string | ||
description: 'tag that is used for build' | ||
service: | ||
required: true | ||
type: string | ||
description: 'name of service to use' | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
|
||
jobs: | ||
publish-ghcr-image: | ||
permissions: | ||
packages: write | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- name: Check out Git repository | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ inputs.tag }} | ||
|
||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v4 | ||
with: | ||
cache: 'maven' | ||
cache-dependency-path: ${{ inputs.service }}/pom.xml | ||
java-version: '17' | ||
distribution: 'temurin' | ||
|
||
- name: build jar without tests | ||
run: mvn -B -ntp -DskipTests package -f ${{ inputs.service }}/pom.xml | ||
|
||
- 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 }}/${{ github.repository }}-${{ inputs.service }} | ||
context: git | ||
# tags: | ||
# - Major | ||
# - Major.Minor | ||
# - full semver: 1.2.3 | ||
# - latest | ||
tags: | | ||
type=match,pattern=(${{ inputs.service }})/v(\d).\d.\d,group=2 | ||
type=match,pattern=(${{ inputs.service }})/v(\d.\d).\d,group=2 | ||
type=match,pattern=(${{ inputs.service }})/v(.*),group=2 | ||
type=raw,value=latest | ||
- name: Build and push image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: ./${{ inputs.service }} | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
name: callable build gh release from tag | ||
on: | ||
workflow_call: | ||
inputs: | ||
tag: | ||
required: true | ||
type: string | ||
description: 'tag that is used for build' | ||
service: | ||
required: true | ||
type: string | ||
description: 'name of service to use' | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
|
||
jobs: | ||
create-gh-release: | ||
permissions: | ||
contents: write | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- name: Check out Git repository | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ inputs.tag }} | ||
|
||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v4 | ||
with: | ||
cache: 'maven' | ||
cache-dependency-path: '${{ inputs.service }}/pom.xml' | ||
java-version: '17' | ||
distribution: 'temurin' | ||
|
||
- name: build jar without tests | ||
run: mvn -B -ntp -DskipTests package -f ${{ inputs.service }}/pom.xml | ||
|
||
- name: Create GitHub Release | ||
id: create_release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
files: | | ||
${{ inputs.service }}/target/*.jar | ||
tag_name: ${{ inputs.tag }} | ||
draft: false | ||
prerelease: false | ||
generate_release_notes: false |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
name: build maven release | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
release-version: | ||
required: true | ||
description: release version | ||
development-version: | ||
required: true | ||
description: next development version | ||
service: | ||
required: true | ||
description: service to build (backend, frontend, ...) | ||
|
||
jobs: | ||
prepare-release: | ||
permissions: | ||
contents: write | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out Git repository | ||
uses: actions/checkout@v4 | ||
- name: Setup git user | ||
uses: fregante/setup-git-user@v2 | ||
- name: Install Java and Maven | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: 17 | ||
distribution: "temurin" | ||
cache: 'maven' | ||
cache-dependency-path: '${{ github.event.inputs.service }}/pom.xml' | ||
- name: Perform maven release | ||
run: > | ||
mvn -B -ntp release:prepare -f backend/pom.xml | ||
-DreleaseVersion=${{ github.event.inputs.release-version }} | ||
-DdevelopmentVersion=${{ github.event.inputs.development-version }} | ||
-Dtag=${{ github.event.inputs.service }}/v${{ github.event.inputs.release-version }} | ||
-Darguments="-DskipTests" | ||
build-gh-release: | ||
permissions: | ||
contents: write | ||
needs: | ||
- prepare-release | ||
uses: | ||
./.github/workflows/callable-create-release-from-tag.yml | ||
with: | ||
tag: ${{ github.event.inputs.service }}/v${{ github.event.inputs.release-version }} | ||
service: ${{ github.event.inputs.service }} | ||
|
||
build-ghcr-image: | ||
permissions: | ||
packages: write | ||
needs: | ||
- prepare-release | ||
uses: | ||
./.github/workflows/callable-create-ghcr-image-from-tag.yml | ||
with: | ||
tag: ${{ github.event.inputs.service }}/v${{ github.event.inputs.release-version }} | ||
service: ${{ github.event.inputs.service }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: build ghcr image from tag | ||
|
||
on: | ||
push: | ||
tags: | ||
- "*/v*" | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
|
||
jobs: | ||
extract-service: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
service: ${{ steps.getTagNameParts.outputs.service }} | ||
version: ${{ steps.getTagNameParts.outputs.version }} | ||
tag: ${{ steps.getTagNameParts.outputs.tag }} | ||
steps: | ||
- uses: olegtarasov/[email protected] | ||
id: getTagNameParts | ||
with: | ||
tagRegex: (?<service>.*)\/v(?<version>.*) #example: backend/v1.2.3 | ||
tagRegexGroup: 0 | ||
|
||
- name: show-service | ||
env: | ||
ghRef: ${{ github.ref }} | ||
service: ${{ steps.getTagNameParts.outputs.service }} | ||
version: ${{ steps.getTagNameParts.outputs.version }} | ||
tagFromAction: ${{ steps.getTagNameParts.outputs.tag }} | ||
run: | | ||
echo "Ref: $ghRef" | ||
echo "Service: $service" | ||
echo "Version: $version" | ||
echo "tagFromAction: $tagFromAction" | ||
publish-ghcr-image: | ||
permissions: | ||
packages: write | ||
needs: | ||
- extract-service | ||
uses: ./.github/workflows/callable-create-ghcr-image-from-tag.yml | ||
with: | ||
tag: ${{ needs.extract-service.outputs.service }}/v${{ needs.extract-service.outputs.version }} | ||
service: ${{ needs.extract-service.outputs.service }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: build gh release from tag | ||
|
||
on: | ||
push: | ||
tags: | ||
- "*/v*" | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
|
||
jobs: | ||
extract-service: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
service: ${{ steps.getTagNameParts.outputs.service }} | ||
version: ${{ steps.getTagNameParts.outputs.version }} | ||
tag: ${{ steps.getTagNameParts.outputs.tag }} | ||
steps: | ||
- uses: olegtarasov/[email protected] | ||
id: getTagNameParts | ||
with: | ||
tagRegex: (?<service>.*)\/v(?<version>.*) #example: backend/v1.2.3 | ||
tagRegexGroup: 0 | ||
|
||
- name: show-service | ||
env: | ||
ghRef: ${{ github.ref }} | ||
service: ${{ steps.getTagNameParts.outputs.service }} | ||
version: ${{ steps.getTagNameParts.outputs.version }} | ||
tagFromAction: ${{ steps.getTagNameParts.outputs.tag }} | ||
run: | | ||
echo "Ref: $ghRef" | ||
echo "Service: $service" | ||
echo "Version: $version" | ||
echo "tagFromAction: $tagFromAction" | ||
publish-ghcr-image: | ||
permissions: | ||
contents: write | ||
needs: | ||
- extract-service | ||
uses: ./.github/workflows/callable-create-release-from-tag.yml | ||
with: | ||
tag: ${{ needs.extract-service.outputs.service }}/v${{ needs.extract-service.outputs.version }} | ||
service: ${{ needs.extract-service.outputs.service }} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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