From 920d837fb9d6c99970628ea0e20d655ee4d29264 Mon Sep 17 00:00:00 2001 From: Arne Weiss Date: Mon, 1 Jun 2026 08:08:34 +0200 Subject: [PATCH] Add Gitea Actions CI/CD pipeline with release workflow --- .gitea/workflows/build.yml | 41 ++++++++++++++++++++++++++++ .gitea/workflows/release.yml | 52 ++++++++++++++++++++++++++++++++++++ 2 files changed, 93 insertions(+) create mode 100644 .gitea/workflows/build.yml create mode 100644 .gitea/workflows/release.yml diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml new file mode 100644 index 0000000..7db97d7 --- /dev/null +++ b/.gitea/workflows/build.yml @@ -0,0 +1,41 @@ +name: Build + +on: + push: + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + container: + image: php:8.2-cli-alpine + + steps: + - name: Install Node.js, git and zip + run: apk add --no-cache nodejs git zip + + - uses: actions/checkout@v4 + + - name: PHP syntax check + run: | + find . -name "*.php" -not -path "./.git/*" -print0 \ + | xargs -0 -n1 php -l + + - name: Build ZIP + run: | + MODULE=simple_withdrawalbutton + cp -rp . /tmp/$MODULE + rm -rf /tmp/$MODULE/.git \ + /tmp/$MODULE/.gitea \ + /tmp/$MODULE/CLAUDE.md + cd /tmp && zip -r ${MODULE}.zip $MODULE/ + mkdir -p $GITHUB_WORKSPACE/dist + mv /tmp/${MODULE}.zip $GITHUB_WORKSPACE/dist/ + echo "Built dist/${MODULE}.zip" + + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: simple_withdrawalbutton + path: dist/simple_withdrawalbutton.zip + if-no-files-found: error diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml new file mode 100644 index 0000000..79c24af --- /dev/null +++ b/.gitea/workflows/release.yml @@ -0,0 +1,52 @@ +name: Release + +on: + push: + tags: + - 'v*' + +jobs: + release: + runs-on: ubuntu-latest + container: + image: php:8.2-cli-alpine + + steps: + - name: Install dependencies + run: apk add --no-cache nodejs git zip curl jq + + - uses: actions/checkout@v4 + + - name: PHP syntax check + run: | + find . -name "*.php" -not -path "./.git/*" -print0 \ + | xargs -0 -n1 php -l + + - name: Build ZIP + run: | + MODULE=simple_withdrawalbutton + cp -rp . /tmp/$MODULE + rm -rf /tmp/$MODULE/.git \ + /tmp/$MODULE/.gitea \ + /tmp/$MODULE/CLAUDE.md + cd /tmp && zip -r ${MODULE}.zip $MODULE/ + mkdir -p $GITHUB_WORKSPACE/dist + mv /tmp/${MODULE}.zip $GITHUB_WORKSPACE/dist/ + + - name: Create Gitea release and upload ZIP + env: + TOKEN: ${{ secrets.GITHUB_TOKEN }} + TAG: ${{ github.ref_name }} + run: | + RELEASE_ID=$(curl -sf -X POST \ + -H "Authorization: token $TOKEN" \ + -H "Content-Type: application/json" \ + "$GITHUB_SERVER_URL/api/v1/repos/$GITHUB_REPOSITORY/releases" \ + -d "{\"tag_name\":\"$TAG\",\"name\":\"$TAG\"}" | jq -r '.id') + + curl -sf -X POST \ + -H "Authorization: token $TOKEN" \ + -F "attachment=@$GITHUB_WORKSPACE/dist/simple_withdrawalbutton.zip" \ + "$GITHUB_SERVER_URL/api/v1/repos/$GITHUB_REPOSITORY/releases/$RELEASE_ID/assets?name=simple_withdrawalbutton.zip" + + echo "Release $TAG created: $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/releases/tag/$TAG"