Add Gitea Actions CI/CD pipeline with release workflow
This commit is contained in:
@@ -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
|
||||
@@ -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"
|
||||
Reference in New Issue
Block a user