Simplify CI workflow - use available python3 and avoid apt-get if not needed
Some checks failed
CI / test (push) Failing after 2s

This commit is contained in:
2026-02-01 05:20:52 +00:00
parent 2ca08443b9
commit 7ba5503f32

View File

@@ -11,26 +11,20 @@ jobs:
steps: steps:
- name: Checkout code - name: Checkout code
run: | run: |
mkdir -p ${{ github.repository }} git clone https://gitea.com/${{ github.repository }} ${{ github.workspace }}
git clone https://gitea.com/${{ github.repository }} . cd ${{ github.workspace }}
git checkout ${{ github.sha }} git checkout ${{ github.sha }}
- name: Set up Python
run: |
apt-get update
apt-get install -y python3 python3-pip
python3 -m pip install --upgrade pip
- name: Build package - name: Build package
run: | run: |
pip3 install build python3 -m pip install --upgrade pip
python3 -m pip install build
python3 -m build python3 -m build
- name: Create Release - name: Create Release
run: | run: |
apt-get install -y curl jq
TOKEN=${{ secrets.GITEA_TOKEN }}
TAG_NAME=$(git describe --tags --abbrev=0 2>/dev/null || git rev-parse --short HEAD) TAG_NAME=$(git describe --tags --abbrev=0 2>/dev/null || git rev-parse --short HEAD)
response=$(curl -s -X POST "https://gitea.com/api/v1/repos/${{ github.repository }}/releases" \ response=$(curl -s -X POST "https://gitea.com/api/v1/repos/${{ github.repository }}/releases" \
-H "Authorization: token $TOKEN" \ -H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \
-H "Content-Type: application/json" \ -H "Content-Type: application/json" \
-d '{ -d '{
"tag_name": "'$TAG_NAME'", "tag_name": "'$TAG_NAME'",
@@ -39,12 +33,12 @@ jobs:
"body": "Release '$TAG_NAME'" "body": "Release '$TAG_NAME'"
}') }')
RELEASE_ID=$(echo $response | jq -r '.id') RELEASE_ID=$(echo $response | grep -o '"id":[0-9]*' | head -1 | grep -o '[0-9]*')
for file in dist/*; do for file in dist/*; do
if [ -f "$file" ]; then if [ -f "$file" ]; then
curl -s -X POST "https://gitea.com/api/v1/repos/${{ github.repository }}/releases/$RELEASE_ID/assets" \ curl -s -X POST "https://gitea.com/api/v1/repos/${{ github.repository }}/releases/$RELEASE_ID/assets" \
-H "Authorization: token $TOKEN" \ -H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \
-F "file=@$file" \ -F "file=@$file" \
-F "name=$(basename $file)" -F "name=$(basename $file)"
fi fi