From fa780827386a5f5190f1733d92bb1692b8b7d0c1 Mon Sep 17 00:00:00 2001 From: Florian Brinker Date: Fri, 20 Sep 2024 02:01:04 +0200 Subject: [PATCH] Implement Gitea Workflow --- .drone.status | 3 -- .drone.yml | 59 ---------------------------------- .gitea/workflows/workflow.yaml | 55 +++++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+), 62 deletions(-) delete mode 100644 .drone.status delete mode 100644 .drone.yml create mode 100644 .gitea/workflows/workflow.yaml diff --git a/.drone.status b/.drone.status deleted file mode 100644 index afd16ef..0000000 --- a/.drone.status +++ /dev/null @@ -1,3 +0,0 @@ -{ - "url": "https://drone.f-brinker.de/fbrinker/elderscrolls-addon-achievementInfo/" -} \ No newline at end of file diff --git a/.drone.yml b/.drone.yml deleted file mode 100644 index 2be2b82..0000000 --- a/.drone.yml +++ /dev/null @@ -1,59 +0,0 @@ ---- -kind: pipeline -name: default - -clone: - disable: true - -steps: -- name: clone - image: alpine/git - commands: - - git clone https://git.f-brinker.de/fbrinker/elderscrolls-addon-achievementInfo.git sources - - cd sources && git checkout $DRONE_COMMIT - -- name: lint - image: alpine - commands: - - apk update - - apk add --no-cache build-base curl unzip - - apk add --no-cache lua5.1 lua5.1-dev luarocks5.1 - - luarocks-5.1 install luacheck - - cd sources - - luacheck ./*.lua - -- name: build - image: alpine - commands: - - apk update && apk add --no-cache zip - # Delete unneeded files/dirs - - rm -rf sources/.git - - rm -rf sources/screenshots - - rm -f sources/.drone.status - - rm -f sources/.drone.yml - - rm -f sources/.luacheckrc - # Set Version and AddonVersion - - export VERSION=$DRONE_TAG - - export ADDON_VERSION=$(echo $DRONE_TAG | sed -E 's/(0|)\.//g') - - sed -i "s/0.123456789/$VERSION/g" sources/AchievementInfoCommon.lua - - sed -i "s/0.123456789/$VERSION/g" sources/AchievementInfo.txt - - sed -i "s/0.123456789/$ADDON_VERSION/g" sources/AchievementInfo.txt - # Rename and zip - - mv sources AchievementInfo - - zip -r "AchievementInfo-$DRONE_TAG.zip" ./AchievementInfo - when: - event: - - tag - -- name: release - image: plugins/gitea-release - settings: - base_url: https://git.f-brinker.de - api_key: - from_secret: gitea_token - files: ./*.zip - title: AchievementInfo ${DRONE_TAG} - note: AchievementInfo/CHANGELOG.md - when: - event: - - tag diff --git a/.gitea/workflows/workflow.yaml b/.gitea/workflows/workflow.yaml new file mode 100644 index 0000000..664959c --- /dev/null +++ b/.gitea/workflows/workflow.yaml @@ -0,0 +1,55 @@ +name: Workflow +run-name: ${{ gitea.actor }} is linting and creating a new release on tag pushes 🚀 +on: [push] + +jobs: + + Linting: + runs-on: ubuntu-latest + steps: + - name: Check out repository code + uses: actions/checkout@v4 + - name: Run Luacheck linter + uses: lunarmodules/luacheck@v1 + + Release: + needs: [Linting] + if: ${{ startsWith(github.ref, 'refs/tags/') }} # only for tags + runs-on: ubuntu-latest + env: + Version: ${{ gitea.ref_name }} + steps: + - name: Check out repository code + uses: actions/checkout@v4 + with: + path: sources + - name: Delete unneeded files/dirs + run: | + rm -rf sources/.git + rm -rf sources/.gitea + rm -rf sources/screenshots + rm -f sources/.luacheckrc + - name: Set Version and AddonVersion + run: | + echo "Version: ${{ env.Version }}" + export ADDON_VERSION=$(echo ${{ env.Version }} | sed -E 's/(0|)\.//g') + sed -i "s/0.123456789/${{ env.Version }}/g" sources/AchievementInfoCommon.lua + sed -i "s/0.123456789/${{ env.Version }}/g" sources/AchievementInfo.txt + sed -i "s/0.123456789/$ADDON_VERSION/g" sources/AchievementInfo.txt + - name: Rename and zip + run: | + mv sources AchievementInfo + zip -r "AchievementInfo-${{ env.Version }}.zip" ./AchievementInfo + - name: Create release + id: create_release + uses: akkuman/gitea-release-action@v1 + with: + token: ${{ secrets.token }} + name: "AchievementInfo ${{ env.Version }}" + tag_name: "${{ env.Version }}" + body_path: AchievementInfo/CHANGELOG.md + draft: false + prerelease: false + sha256sum: true + files: |- + *.zip \ No newline at end of file