Files
Iris/.gitea/workflows/ci.yml
Colin Powell 199c9eb5cc
Some checks failed
CI / test (push) Successful in 1m22s
CI / deploy (push) Failing after 51s
[ci] Try different upload tack
2026-06-28 12:42:47 -04:00

106 lines
3.2 KiB
YAML

name: CI
on:
push:
branches:
- '**'
pull_request:
branches:
- main
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
- name: Install dependencies
run: npm ci
- name: Lint
run: npm run lint
- name: Test
run: npm test
deploy:
if: github.ref == 'refs/heads/main' && needs.test.result == 'success'
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
- name: Get version
id: version
run: echo "version=$(cat IRIS_VERSION)" >> "$GITHUB_OUTPUT"
- name: Build frontend assets
run: |
npm ci
npm run build
- name: Build Python sdist
run: |
pip install --break-system-packages build
python -m build --sdist
- name: Upload release asset to Gitea
env:
GITEA_TOKEN: ${{ secrets.GITEA }}
run: |
set -e
VERSION=$(cat IRIS_VERSION)
ASSET="dist/Mopidy_Iris-${VERSION}.tar.gz"
API="https://code.lab.unbl.ink/api/v1/repos/secstate/Iris"
# Delete old continuous tag (ignore if missing)
curl -sf -X DELETE "${API}/tags/continuous" \
-H "Authorization: token ${GITEA_TOKEN}" || true
# Delete old continuous release (ignore if missing)
OLD_ID=$(curl -sf "${API}/releases/tags/continuous" \
-H "Authorization: token ${GITEA_TOKEN}" \
| python3 -c "import sys,json;print(json.load(sys.stdin).get('id',''))" 2>/dev/null || true)
if [ -n "$OLD_ID" ]; then
curl -sf -X DELETE "${API}/releases/${OLD_ID}" \
-H "Authorization: token ${GITEA_TOKEN}"
fi
# Create new release — capture the release ID
RELEASE_JSON=$(curl -sf -X POST "${API}/releases" \
-H "Authorization: token ${GITEA_TOKEN}" \
-H "Content-Type: application/json" \
-d '{"tag_name":"continuous","name":"Continuous build","prerelease":true,"target_commitish":"main"}')
echo "Release created: $RELEASE_JSON"
RELEASE_ID=$(echo "$RELEASE_JSON" | python3 -c "import sys,json;print(json.load(sys.stdin)['id'])")
# Upload asset using numeric release ID (compatible with all Gitea versions)
curl -sf -X POST "${API}/releases/${RELEASE_ID}/assets" \
-H "Authorization: token ${GITEA_TOKEN}" \
-F "attachment=@${ASSET}"
echo "Asset uploaded successfully"
- name: Install on server from release
uses: appleboy/ssh-action@v1.0.3
with:
host: mopidy-dev.service
username: root
key: ${{ secrets.JAIL_KEY }}
envs: VERSION
env:
VERSION: ${{ steps.version.outputs.version }}
script: |
pip uninstall -y --break-system-packages mopidy-iris
pip install --break-system-packages \
"https://code.lab.unbl.ink/secstate/Iris/releases/download/continuous/Mopidy_Iris-${VERSION}.tar.gz"
service mopidy restart