Compare commits
4 Commits
2722c99b82
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| b123f5b77f | |||
| 2e9166220b | |||
| c04fbd05fd | |||
| d0c7f47441 |
31
.gitea/workflows/gradle-build.yaml
Normal file
31
.gitea/workflows/gradle-build.yaml
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
name: Gradle Build on PR
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
JAVA_VERSION:
|
||||||
|
default: 17
|
||||||
|
description: Java version to use
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
BUILD_OPTION:
|
||||||
|
default: ""
|
||||||
|
description: Gradle build option
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
gradle-build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout Repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 1
|
||||||
|
- name: Set up JDK
|
||||||
|
uses: actions/setup-java@v4
|
||||||
|
with:
|
||||||
|
distribution: temurin
|
||||||
|
java-version: ${{ inputs.JAVA_VERSION }}
|
||||||
|
- name: Run Gradle Build
|
||||||
|
run: ./gradlew build ${{ inputs.BUILD_OPTION }}
|
||||||
@@ -12,15 +12,6 @@ on:
|
|||||||
description: Branch reference
|
description: Branch reference
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
GRADLE_TASK:
|
|
||||||
description: Gradle task to run (e.g., 'build publish' or 'publishPluginMavenPublicationToGitHubPackagesRepository')
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
secrets:
|
|
||||||
CI_BOT_USERNAME:
|
|
||||||
required: true
|
|
||||||
CI_BOT_TOKEN:
|
|
||||||
required: true
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
publish-artifact:
|
publish-artifact:
|
||||||
@@ -38,7 +29,7 @@ jobs:
|
|||||||
distribution: temurin
|
distribution: temurin
|
||||||
java-version: ${{ inputs.JAVA_VERSION }}
|
java-version: ${{ inputs.JAVA_VERSION }}
|
||||||
- name: Run Gradle
|
- name: Run Gradle
|
||||||
run: ./gradlew ${{ inputs.GRADLE_TASK }}
|
run: ./gradlew publishAllPublicationsToGiteaPackagesRepository
|
||||||
shell: bash
|
shell: bash
|
||||||
env:
|
env:
|
||||||
REPOSITORY_USER: ${{ secrets.CI_BOT_USERNAME }}
|
REPOSITORY_USER: ${{ secrets.CI_BOT_USERNAME }}
|
||||||
|
|||||||
@@ -8,29 +8,66 @@ on:
|
|||||||
required: false
|
required: false
|
||||||
type: string
|
type: string
|
||||||
default: '17'
|
default: '17'
|
||||||
PROJECT_VERSION:
|
BRANCH_REFERENCE:
|
||||||
description: Branch reference
|
description: Branch reference
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
PROJECT_NAME:
|
|
||||||
description: Project name
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
secrets:
|
|
||||||
CI_BOT_USERNAME:
|
|
||||||
required: true
|
|
||||||
CI_BOT_TOKEN:
|
|
||||||
required: true
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
publish-artifact:
|
publish-artifact:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Print things
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 1
|
||||||
|
ref: ${{ inputs.BRANCH_REFERENCE }}
|
||||||
|
token: ${{ secrets.CI_BOT_TOKEN }}
|
||||||
|
- name: Set up JDK
|
||||||
|
uses: actions/setup-java@v4
|
||||||
|
with:
|
||||||
|
distribution: temurin
|
||||||
|
java-version: ${{ inputs.JAVA_VERSION }}
|
||||||
|
- name: Extract project information
|
||||||
|
id: project
|
||||||
run: |
|
run: |
|
||||||
echo "A: ${{ vars.BOT_NAME }}"
|
NAME=$(awk -F '=' '/^rootProject\.name/{gsub(/[[:space:]]*/,"",$2); gsub(/"/,"",$2); print $2}' settings.gradle.kts)
|
||||||
echo "B: ${{ vars.BOT_EMAIL }}"
|
if [ -z "$NAME" ]; then
|
||||||
echo "C: ${{ inputs.JAVA_VERSION }}"
|
echo "Error: No application name found in settings.gradle.kts" >&2
|
||||||
echo "D: ${{ inputs.PROJECT_VERSION }}"
|
exit 1
|
||||||
echo "E: ${{ inputs.PROJECT_NAME }}"
|
fi
|
||||||
echo "F: ${{ secrets.CI_BOT_USERNAME }}"
|
VERSION=$(awk -F '=' '/^version[[:space:]]*=/{gsub(/[[:space:]]*/,"",$2); print $2}' gradle.properties)
|
||||||
|
if [ -z "$VERSION" ]; then
|
||||||
|
echo "Error: No version found in gradle.properties" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "name=$NAME" >> $GITHUB_OUTPUT
|
||||||
|
echo "Extracted application name: $NAME"
|
||||||
|
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
||||||
|
echo "Extracted application version: $VERSION"
|
||||||
|
- name: Build Docker Image
|
||||||
|
run: ./gradlew dockerBuildImage
|
||||||
|
env:
|
||||||
|
REPOSITORY_USER: ${{ secrets.CI_BOT_USERNAME }}
|
||||||
|
REPOSITORY_TOKEN: ${{ secrets.CI_BOT_TOKEN }}
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
with:
|
||||||
|
install: true
|
||||||
|
driver: docker-container
|
||||||
|
- name: Log in to Gitea Container Registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: gitea.lulz.ltd
|
||||||
|
username: ${{ secrets.CI_BOT_USERNAME }}
|
||||||
|
password: ${{ secrets.CI_BOT_TOKEN }}
|
||||||
|
- name: Build and push Docker image
|
||||||
|
uses: docker/build-push-action@v6
|
||||||
|
with:
|
||||||
|
context: ./build/docker/
|
||||||
|
platforms: linux/amd64
|
||||||
|
provenance: false
|
||||||
|
push: true
|
||||||
|
sbom: false
|
||||||
|
tags: |
|
||||||
|
gitea.lulz.ltd/aura-ascend/${{ steps.project.outputs.name }}:${{ steps.project.outputs.version }}
|
||||||
|
|||||||
@@ -23,19 +23,12 @@ on:
|
|||||||
description: Type of release (service, library, plugin, or catalog)
|
description: Type of release (service, library, plugin, or catalog)
|
||||||
required: false
|
required: false
|
||||||
type: string
|
type: string
|
||||||
secrets:
|
|
||||||
CI_BOT_USERNAME:
|
|
||||||
required: true
|
|
||||||
CI_BOT_TOKEN:
|
|
||||||
required: true
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
release:
|
release:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
outputs:
|
outputs:
|
||||||
project-name: ${{ steps.project.outputs.name }}
|
|
||||||
release-version: ${{ steps.project.outputs.version }}
|
release-version: ${{ steps.project.outputs.version }}
|
||||||
has-changes: ${{ steps.project.outputs.change }}
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@@ -51,11 +44,6 @@ jobs:
|
|||||||
- name: Extract project information
|
- name: Extract project information
|
||||||
id: project
|
id: project
|
||||||
run: |
|
run: |
|
||||||
NAME=$(awk -F '=' '/^rootProject\.name/ { gsub(/[[:space:]]*/,"",$2); gsub(/"/,"",$2); print $2 }' settings.gradle.kts)
|
|
||||||
if [ -z "$NAME" ]; then
|
|
||||||
echo "Error: No application name found in settings.gradle.kts" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
VERSION=$(awk -F '=' '/^version[[:space:]]*=/{ gsub(/[[:space:]]*/,"",$2); sub(/-SNAPSHOT$/,"",$2); print $2 }' gradle.properties)
|
VERSION=$(awk -F '=' '/^version[[:space:]]*=/{ gsub(/[[:space:]]*/,"",$2); sub(/-SNAPSHOT$/,"",$2); print $2 }' gradle.properties)
|
||||||
if [ -z "$VERSION" ]; then
|
if [ -z "$VERSION" ]; then
|
||||||
echo "Error: No version found in gradle.properties" >&2
|
echo "Error: No version found in gradle.properties" >&2
|
||||||
@@ -65,8 +53,6 @@ jobs:
|
|||||||
if [[ $(git log -1 --pretty=%B) != *"[RELEASE] - Bump version"* ]]; then
|
if [[ $(git log -1 --pretty=%B) != *"[RELEASE] - Bump version"* ]]; then
|
||||||
CHANGE="true"
|
CHANGE="true"
|
||||||
fi
|
fi
|
||||||
echo "name=$NAME" >> $GITHUB_OUTPUT
|
|
||||||
echo "Extracted application name: $NAME"
|
|
||||||
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
||||||
echo "Extracted application version: $VERSION"
|
echo "Extracted application version: $VERSION"
|
||||||
echo "change=$CHANGE" >> $GITHUB_OUTPUT
|
echo "change=$CHANGE" >> $GITHUB_OUTPUT
|
||||||
@@ -77,7 +63,7 @@ jobs:
|
|||||||
echo "No changes to release, failing..."
|
echo "No changes to release, failing..."
|
||||||
exit 1
|
exit 1
|
||||||
- name: Un-snapshot catalog versions
|
- name: Un-snapshot catalog versions
|
||||||
if: ${{ inputs.TYPE == 'catalog' }}
|
if: ${{ inputs.RELEASE_TYPE == 'catalog' }}
|
||||||
run: |
|
run: |
|
||||||
if [ -f versions-catalog.toml ]; then
|
if [ -f versions-catalog.toml ]; then
|
||||||
sed -i -E 's/^(lulz[A-Za-z]+[[:space:]]*=[[:space:]]*")([0-9]+\.[0-9]+\.[0-9]+)-SNAPSHOT(")/\1\2\3/' versions-catalog.toml
|
sed -i -E 's/^(lulz[A-Za-z]+[[:space:]]*=[[:space:]]*")([0-9]+\.[0-9]+\.[0-9]+)-SNAPSHOT(")/\1\2\3/' versions-catalog.toml
|
||||||
@@ -134,39 +120,18 @@ jobs:
|
|||||||
|
|
||||||
finalise-publish-artifact:
|
finalise-publish-artifact:
|
||||||
needs: release
|
needs: release
|
||||||
if: inputs.RELEASE_TYPE == 'library' || inputs.RELEASE_TYPE == 'catalog'
|
if: inputs.RELEASE_TYPE == 'catalog' || inputs.RELEASE_TYPE == 'library' || inputs.RELEASE_TYPE == 'plugin'
|
||||||
uses: aura-ascend/common-workflows/.gitea/workflows/publish-artifact.yaml@master
|
uses: aura-ascend/common-workflows/.gitea/workflows/publish-artifact.yaml@master
|
||||||
with:
|
with:
|
||||||
JAVA_VERSION: ${{ inputs.JAVA_VERSION }}
|
JAVA_VERSION: ${{ inputs.JAVA_VERSION }}
|
||||||
BRANCH_REFERENCE: "v${{ needs.release.outputs.release-version }}"
|
BRANCH_REFERENCE: "v${{ needs.release.outputs.release-version }}"
|
||||||
GRADLE_TASK: publish
|
secrets: inherit
|
||||||
secrets:
|
|
||||||
CI_BOT_USERNAME: ${{ secrets.CI_BOT_USERNAME }}
|
|
||||||
CI_BOT_TOKEN: ${{ secrets.CI_BOT_TOKEN }}
|
|
||||||
|
|
||||||
# finalise-publish-plugin:
|
|
||||||
# needs: release
|
|
||||||
# if: needs.release.outputs.has-changes == 'true' && inputs.RELEASE_TYPE == 'plugin'
|
|
||||||
# uses: aura-ascend/common-workflows/.gitea/workflows/publish-artifact.yaml@master
|
|
||||||
# with:
|
|
||||||
# JAVA_VERSION: ${{ inputs.JAVA_VERSION }}
|
|
||||||
# BRANCH_REFERENCE: "v${{ needs.release.outputs.release-version }}"
|
|
||||||
# GRADLE_TASK: publishAllPublicationsToGitHubPackagesRepository
|
|
||||||
# secrets:
|
|
||||||
# CI_BOT_USERNAME: ${{ secrets.CI_BOT_USERNAME }}
|
|
||||||
# CI_BOT_TOKEN: ${{ secrets.CI_BOT_TOKEN }}
|
|
||||||
|
|
||||||
finalise-publish-container:
|
finalise-publish-container:
|
||||||
needs: release
|
needs: release
|
||||||
# if: needs.release.outputs.has-changes == 'true'
|
if: inputs.RELEASE_TYPE == 'service'
|
||||||
# if: needs.release.outputs.has-changes == 'true' && inputs.RELEASE_TYPE == 'service'
|
|
||||||
uses: aura-ascend/common-workflows/.gitea/workflows/publish-container.yaml@master
|
uses: aura-ascend/common-workflows/.gitea/workflows/publish-container.yaml@master
|
||||||
with:
|
with:
|
||||||
JAVA_VERSION: ${{ inputs.JAVA_VERSION }}
|
JAVA_VERSION: ${{ inputs.JAVA_VERSION }}
|
||||||
# PROJECT_VERSION: ${{ needs.release.outputs.release-version }}
|
|
||||||
PROJECT_VERSION: "v${{ needs.release.outputs.release-version }}"
|
PROJECT_VERSION: "v${{ needs.release.outputs.release-version }}"
|
||||||
PROJECT_NAME: ${{ needs.release.outputs.project-name }}
|
secrets: inherit
|
||||||
secrets:
|
|
||||||
CI_BOT_USERNAME: ${{ secrets.CI_BOT_USERNAME }}
|
|
||||||
CI_BOT_TOKEN: ${{ secrets.CI_BOT_TOKEN }}
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user