add release
This commit is contained in:
@@ -26,20 +26,17 @@ jobs:
|
|||||||
publish-artifact:
|
publish-artifact:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 1
|
fetch-depth: 1
|
||||||
ref: ${{ inputs.BRANCH_REFERENCE }}
|
ref: ${{ inputs.BRANCH_REFERENCE }}
|
||||||
token: ${{ secrets.CI_BOT_TOKEN }}
|
token: ${{ secrets.CI_BOT_TOKEN }}
|
||||||
|
|
||||||
- name: Set up JDK
|
- name: Set up JDK
|
||||||
uses: actions/setup-java@v4
|
uses: actions/setup-java@v4
|
||||||
with:
|
with:
|
||||||
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 ${{ inputs.GRADLE_TASK }}
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|||||||
36
.gitea/workflows/publish-container.yaml
Normal file
36
.gitea/workflows/publish-container.yaml
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
name: Publish Docker Images
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
JAVA_VERSION:
|
||||||
|
description: Java version to use
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
default: '17'
|
||||||
|
PROJECT_VERSION:
|
||||||
|
description: Branch reference
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
PROJECT_NAME:
|
||||||
|
description: Project name
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
secrets:
|
||||||
|
CI_BOT_USERNAME:
|
||||||
|
required: true
|
||||||
|
CI_BOT_TOKEN:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
publish-artifact:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Print things
|
||||||
|
run: |
|
||||||
|
echo "A: ${{ vars.BOT_NAME }}"
|
||||||
|
echo "B: ${{ vars.BOT_EMAIL }}"
|
||||||
|
echo "C: ${{ inputs.JAVA_VERSION }}"
|
||||||
|
echo "D: ${{ inputs.PROJECT_VERSION }}"
|
||||||
|
echo "E: ${{ inputs.PROJECT_NAME }}"
|
||||||
|
echo "F: ${{ secrets.CI_BOT_USERNAME }}"
|
||||||
84
.gitea/workflows/release.yaml
Normal file
84
.gitea/workflows/release.yaml
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
name: Release
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
JAVA_VERSION:
|
||||||
|
default: 17
|
||||||
|
description: Java version to use
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
FAIL_FOR_NO_CHANGES:
|
||||||
|
default: true
|
||||||
|
description: Fail if there were no changes to release
|
||||||
|
required: false
|
||||||
|
type: boolean
|
||||||
|
DATABASE_FILES:
|
||||||
|
default: ''
|
||||||
|
description: Whether to handle database files
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
RELEASE_TYPE:
|
||||||
|
default: ''
|
||||||
|
description: Type of release (service, artifact, plugin, or catalog)
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
secrets:
|
||||||
|
CI_BOT_USERNAME:
|
||||||
|
required: true
|
||||||
|
CI_BOT_TOKEN:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
project-name: ${{ steps.project-info.outputs.name }}
|
||||||
|
release-version: ${{ steps.project-info.outputs.version }}
|
||||||
|
has-changes: ${{ steps.project-info.outputs.change }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 1
|
||||||
|
token: ${{ secrets.CI_BOT_TOKEN }}
|
||||||
|
- name: Set git credentials
|
||||||
|
run: |
|
||||||
|
git config --global user.name "${{ vars.BOT_NAME }}"
|
||||||
|
git config --global user.email "${{ vars.BOT_EMAIL }}"
|
||||||
|
echo "Set Git name: ${{ vars.BOT_NAME }}"
|
||||||
|
echo "Set Git email: ${{ vars.BOT_EMAIL }}"
|
||||||
|
- name: Extract project information
|
||||||
|
id: project
|
||||||
|
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)
|
||||||
|
if [ -z "$VERSION" ]; then
|
||||||
|
echo "Error: No version found in gradle.properties" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
CHANGE="false"
|
||||||
|
if [[ $(git log -1 --pretty=%B) != *"[RELEASE] - Bump version"* ]]; then
|
||||||
|
CHANGE="true"
|
||||||
|
fi
|
||||||
|
echo "name=$NAME" >> $GITHUB_OUTPUT
|
||||||
|
echo "Extracted application name: $NAME"
|
||||||
|
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
||||||
|
echo "Extracted application version: $VERSION"
|
||||||
|
echo "change=$CHANGE" >> $GITHUB_OUTPUT
|
||||||
|
echo "Has changes to release? $CHANGE"
|
||||||
|
|
||||||
|
finalise-docker-images:
|
||||||
|
needs: release
|
||||||
|
uses: aura-ascend/common-workflows/.gitea/workflows/publish-container.yaml@master
|
||||||
|
with:
|
||||||
|
JAVA_VERSION: ${{ inputs.JAVA_VERSION }}
|
||||||
|
PROJECT_VERSION: ${{ needs.release.outputs.release-version }}
|
||||||
|
PROJECT_NAME: ${{ needs.release.outputs.project-name }}
|
||||||
|
secrets:
|
||||||
|
CI_BOT_USERNAME: ${{ secrets.CI_BOT_USERNAME }}
|
||||||
|
CI_BOT_TOKEN: ${{ secrets.CI_BOT_TOKEN }}
|
||||||
@@ -5,8 +5,11 @@ Rules and stuff say keep workflow in `/.gite/workflow` look at `/.gite/actions`
|
|||||||
## Actions secrets and variables.
|
## Actions secrets and variables.
|
||||||
|
|
||||||
### Secrets
|
### Secrets
|
||||||
|
|
||||||
- CI_BOT_USERNAME = gitea_username
|
- CI_BOT_USERNAME = gitea_username
|
||||||
- CI_BOT_TOKEN = gitea_token
|
- CI_BOT_TOKEN = gitea_token
|
||||||
|
|
||||||
### Variables
|
### Variables
|
||||||
|
|
||||||
|
- BOT_NAME
|
||||||
|
- BOT_EMAIL
|
||||||
|
|||||||
Reference in New Issue
Block a user