From b6e1ef4fa597ee3c05404149ebccfaf4b0030d30 Mon Sep 17 00:00:00 2001 From: aminecmi Date: Sat, 23 Nov 2024 15:19:29 +0100 Subject: [PATCH] chore: Gitea Action --- .gitea/workflows/common_build.yml | 24 +++++++++++++++++ .gitea/workflows/on_merge_on_release.yml | 34 +++++++++++++++++------- .gitea/workflows/on_pr.yml | 6 +++-- .gitea/workflows/on_push.yml | 27 +++---------------- .gitea/workflows/on_tag.yml | 6 ++--- README.md | 2 +- 6 files changed, 59 insertions(+), 40 deletions(-) create mode 100644 .gitea/workflows/common_build.yml diff --git a/.gitea/workflows/common_build.yml b/.gitea/workflows/common_build.yml new file mode 100644 index 0000000..8db1abc --- /dev/null +++ b/.gitea/workflows/common_build.yml @@ -0,0 +1,24 @@ +name: Build +on: + workflow_call: + +jobs: + BuildAndTest: + runs-on: ubuntu-latest + steps: + - name: Check out repository code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Fetch tags + run: git fetch --tags -p + - uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: '17' + - name: Setup Android SDK + uses: android-actions/setup-android@v3 + - name: Configure gradle... + run: mkdir -p ~/.gradle && echo "org.gradle.daemon=false\nignoreGitVersion=true\nsystemProp.org.gradle.internal.http.connectionTimeout=180000\nsystemProp.org.gradle.internal.http.socketTimeout=180000" >> ~/.gradle/gradle.properties + - name: Build and test + run: ./gradlew build --stacktrace diff --git a/.gitea/workflows/on_merge_on_release.yml b/.gitea/workflows/on_merge_on_release.yml index dcb058a..a9cefe3 100644 --- a/.gitea/workflows/on_merge_on_release.yml +++ b/.gitea/workflows/on_merge_on_release.yml @@ -1,41 +1,55 @@ -name: Tag +name: Create tag on: push: branches: - release jobs: + #build: + #uses: ./.gitea/workflows/common_build.yml createTagAndChangelog: - needs: BuildAndTest runs-on: ubuntu-latest + #needs: build steps: - name: Check out repository code uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Creating the tag + persist-credentials: false + - name: Config git + run: | + git config --global user.email aminecmi+giteadrone@pm.me + git config --global user.name giteadrone + - name: Creating the tag and generate changelog run: | git fetch --tags -p PREV=$(git describe --tags --abbrev=0) ./build.sh --publish --from-ci - - name: Generating changelog - run: | VER=$(git describe --tags --abbrev=0) CHANGELOG=$(git log $PREV..HEAD --pretty="- %s") echo "**$VER**\n\n$CHANGELOG\n\n--------------------------------------------------------------------\n\n$(cat CHANGELOG.md)" > CHANGELOG.md git add CHANGELOG.md - git config --global user.email "aminecmi+giteadrone@pm.me" - git config --global user.name "Gitea actions runner" git commit -m "Changelog for $VER" - git push --tags + - name: Push changes + uses: appleboy/git-push-action@v1.0.0 + with: + author_name: giteadrone + author_email: aminecmi+giteadrone@pm.me + remote: ${{ secrets.REMOTE_URL }} + remote_name: origin + followtags: true + ssh_key: ${{ secrets.PRIVATE_KEY }} + tags: true + branch: release - name: copy file via ssh password uses: appleboy/scp-action@v0.1.7 with: host: amine-bouabdallaoui.fr username: ubuntu key: ${{ secrets.PRIVATE_KEY }} - source: "version.txt" - target: "/home/ubuntu/" + port: 22 + source: version.txt + target: /home/ubuntu/ - name: deploy version file uses: appleboy/ssh-action@v1.2.0 with: diff --git a/.gitea/workflows/on_pr.yml b/.gitea/workflows/on_pr.yml index 6176dfa..81aa997 100644 --- a/.gitea/workflows/on_pr.yml +++ b/.gitea/workflows/on_pr.yml @@ -1,4 +1,4 @@ -name: Push/PR Steps +name: Check PR code on: pull_request: branches: @@ -21,4 +21,6 @@ jobs: - name: Linting... run: ktlint 'shared/**/*.kt' 'androidApp/**/*.kt' '!shared/build' || true - name: Detecting... - run: ./detekt-cli-1.23.1/bin/detekt-cli --all-rules --excludes '**/shared/build/**/*.kt' || true \ No newline at end of file + run: ./detekt-cli-1.23.1/bin/detekt-cli --all-rules --excludes '**/shared/build/**/*.kt' || true + build: + uses: ./.gitea/workflows/common_build.yml \ No newline at end of file diff --git a/.gitea/workflows/on_push.yml b/.gitea/workflows/on_push.yml index 2fe7203..101d35b 100644 --- a/.gitea/workflows/on_push.yml +++ b/.gitea/workflows/on_push.yml @@ -1,30 +1,9 @@ -name: Push/PR Steps +name: Check master code on: - pull_request: - branches: - - master push: branches: - master - - release jobs: - BuildAndTest: - runs-on: ubuntu-latest - steps: - - name: Check out repository code - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Fetch tags - run: git fetch --tags -p - - uses: actions/setup-java@v4 - with: - distribution: 'temurin' - java-version: '17' - - name: Setup Android SDK - uses: android-actions/setup-android@v3 - - name: Configure gradle... - run: mkdir -p ~/.gradle && echo "org.gradle.daemon=false\nignoreGitVersion=true\nsystemProp.org.gradle.internal.http.connectionTimeout=180000\nsystemProp.org.gradle.internal.http.socketTimeout=180000" >> ~/.gradle/gradle.properties - - name: Build and test - run: ./gradlew build --stacktrace + build: + uses: ./.gitea/workflows/common_build.yml \ No newline at end of file diff --git a/.gitea/workflows/on_tag.yml b/.gitea/workflows/on_tag.yml index 0a27ea4..adea18b 100644 --- a/.gitea/workflows/on_tag.yml +++ b/.gitea/workflows/on_tag.yml @@ -1,11 +1,11 @@ -name: Tag +name: Create release on: push: tags: - - 'v*' jobs: - build: + release: + runs-on: ubuntu-latest steps: - name: Check out repository code uses: actions/checkout@v4 diff --git a/README.md b/README.md index d5089b7..d58f904 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# ReaderForSelfoss-multiplatform [![Build Status](https://build.amine-bouabdallaoui.fr/api/badges/Louvorg/ReaderForSelfoss-multiplatform/status.svg)](https://build.amine-bouabdallaoui.fr/Louvorg/ReaderForSelfoss-multiplatform) +# ReaderForSelfoss-multiplatform [![Build Status](https://gitea.amine-bouabdallaoui.fr/Louvorg/ReaderForSelfoss-multiplatform/actions/workflows/on_push.yml/badge.svg)](https://gitea.amine-bouabdallaoui.fr/Louvorg/ReaderForSelfoss-multiplatform/actions?workflow=on_push.yml&actor=0&status=0) [![Crowdin](https://d322cqt584bo4o.cloudfront.net/readerforselfoss/localized.svg)](https://crowdin.com/project/readerforselfoss)