-
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.
- Loading branch information
Showing
9 changed files
with
147 additions
and
58 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
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
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
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
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 |
---|---|---|
@@ -1,28 +1,69 @@ | ||
name: Release workflow | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
workflow_dispatch: # Allows manual triggering | ||
|
||
env: | ||
REGISTRY_IMAGE: registry.shikkanime.fr:5000/shikkanime-core | ||
JAVA_VERSION: 21 | ||
REGISTRY_IMAGE: ${{ vars.DOCKERHUB_USERNAME }}/shikkanime-core | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up JDK ${{ env.JAVA_VERSION }} | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: ${{ env.JAVA_VERSION }} | ||
distribution: 'corretto' | ||
- name: Build and test | ||
run: ./gradlew clean test --info | ||
|
||
upgrade-version: | ||
runs-on: ubuntu-latest | ||
|
||
outputs: | ||
v-version: ${{ steps.version.outputs.v-version }} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Get next version | ||
uses: reecetech/[email protected] | ||
id: version | ||
with: | ||
scheme: conventional_commits | ||
|
||
docker: | ||
runs-on: ubuntu-latest | ||
needs: [test, upgrade-version] | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
build_version: [slim, full] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up JDK 21 | ||
# Pull the latest commits | ||
- name: Pull latest commits | ||
run: git pull | ||
|
||
- name: Set up JDK ${{ env.JAVA_VERSION }} | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: 21 | ||
java-version: ${{ env.JAVA_VERSION }} | ||
distribution: 'corretto' | ||
|
||
- name: Build | ||
run: gradle clean installDist | ||
- name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ env.REGISTRY_IMAGE }} | ||
tags: | | ||
type=raw,value=${{ matrix.build_version }} | ||
type=raw,value=${{ matrix.build_version }}-${{ needs.upgrade-version.outputs.v-version }} | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
@@ -33,41 +74,79 @@ jobs: | |
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: registry.shikkanime.fr:5000 | ||
username: ziedelth | ||
password: ${{ secrets.REGISTRY_PASSWORD }} | ||
username: ${{ vars.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Update version in build.gradle.kts | ||
run: | | ||
#!/bin/bash | ||
PROJECT_VERSION=$(cat 'build.gradle.kts' | grep -oP 'version = "\K[^\\"]*' | head -n 1) | ||
# Update the file | ||
sed -i "s|$PROJECT_VERSION|${{ needs.upgrade-version.outputs.v-version }}|g" build.gradle.kts | ||
- name: Build | ||
run: gradle clean installDist | ||
|
||
- name: Build docker file | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: . | ||
file: Dockerfile | ||
build-args: BUILD_VERSION=${{ matrix.build_version }} | ||
platforms: linux/amd64,linux/arm64 | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
cache-from: type=registry,ref=${{ env.REGISTRY_IMAGE }}:buildcache-${{ matrix.build_version }} | ||
cache-to: type=registry,ref=${{ env.REGISTRY_IMAGE }}:buildcache-${{ matrix.build_version }},mode=max | ||
push: true | ||
tags: ${{ env.REGISTRY_IMAGE }}:latest,${{ env.REGISTRY_IMAGE }}:${{ steps.version.outputs.v-version }} | ||
platforms: linux/arm64/v8 | ||
cache-from: type=registry,ref=${{ env.REGISTRY_IMAGE }}:buildcache | ||
cache-to: type=registry,ref=${{ env.REGISTRY_IMAGE }}:buildcache | ||
|
||
- name: Get next version | ||
uses: reecetech/[email protected] | ||
id: version | ||
push-commit: | ||
runs-on: ubuntu-latest | ||
needs: [upgrade-version, docker] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
scheme: conventional_commits | ||
persist-credentials: false | ||
fetch-depth: 0 | ||
|
||
- name: Generate Git Tag | ||
id: generate_tag | ||
- name: Update version in build.gradle.kts | ||
run: | | ||
NEW_TAG="${{ steps.version.outputs.v-version }}" | ||
echo "Generated new tag: $NEW_TAG" | ||
echo "NEW_TAG=$NEW_TAG" >> $GITHUB_ENV | ||
#!/bin/bash | ||
PROJECT_VERSION=$(cat 'build.gradle.kts' | grep -oP 'version = "\K[^\\"]*' | head -n 1) | ||
# Update the file | ||
sed -i "s|$PROJECT_VERSION|${{ needs.upgrade-version.outputs.v-version }}|g" build.gradle.kts | ||
# Set up Git | ||
git config user.name Ziedelth | ||
git config user.email ${{ secrets.USER_EMAIL }} | ||
# Commit the changes | ||
git add build.gradle.kts | ||
git commit -m "Update version to ${{ needs.upgrade-version.outputs.v-version }}" | ||
- name: Push changes | ||
uses: ad-m/[email protected] | ||
with: | ||
github_token: ${{ secrets.USER_TOKEN }} | ||
branch: ${{ github.ref }} | ||
force: true | ||
|
||
push-tag: | ||
runs-on: ubuntu-latest | ||
needs: [upgrade-version, push-commit] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
# Pull the latest commits | ||
- name: Pull latest commits | ||
run: git pull | ||
|
||
- name: Push Git Tag | ||
run: | | ||
git config user.name "GitHub Actions" | ||
git config user.email "[email protected]" | ||
git tag $NEW_TAG | ||
git push origin $NEW_TAG | ||
- uses: marvinpinto/[email protected] | ||
with: | ||
repo_token: "${{ secrets.GITHUB_TOKEN }}" | ||
prerelease: false | ||
git tag ${{ needs.upgrade-version.outputs.v-version }} | ||
git push origin ${{ needs.upgrade-version.outputs.v-version }} |
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 |
---|---|---|
|
@@ -18,6 +18,4 @@ jobs: | |
- name: Update Gradle Wrapper | ||
uses: gradle-update/[email protected] | ||
with: | ||
reviewers: Ziedelth | ||
base-branch: dev | ||
target-branch: dev | ||
reviewers: Ziedelth |
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
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
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