ci: remove GitHub-hosted action dependencies
This commit is contained in:
@ -12,66 +12,54 @@ jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.11'
|
||||
|
||||
- name: Install test deps
|
||||
- name: Verify workspace and Python
|
||||
run: |
|
||||
python -m venv .venv-ci
|
||||
. .venv-ci/bin/activate
|
||||
pip install --upgrade pip
|
||||
pip install -r requirements.txt pytest
|
||||
pwd
|
||||
ls -la
|
||||
python3 --version
|
||||
|
||||
- name: Run tests
|
||||
run: |
|
||||
python3 -m venv .venv-ci
|
||||
. .venv-ci/bin/activate
|
||||
pip install --upgrade pip
|
||||
pip install -r requirements.txt pytest
|
||||
pytest -q
|
||||
|
||||
build-linux:
|
||||
needs: test
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.11'
|
||||
|
||||
- name: Install OS deps
|
||||
- name: Verify build environment
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y python3-venv libfuse2 wget jq
|
||||
pwd
|
||||
python3 --version
|
||||
tar --version | head -1
|
||||
|
||||
- name: Build Linux binary
|
||||
run: bash build/build_linux.sh
|
||||
|
||||
- name: Install appimagetool
|
||||
run: |
|
||||
wget -O /tmp/appimagetool.AppImage \
|
||||
https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage
|
||||
chmod +x /tmp/appimagetool.AppImage
|
||||
sudo mv /tmp/appimagetool.AppImage /usr/local/bin/appimagetool
|
||||
bash build/build_linux.sh
|
||||
|
||||
- name: Build AppImage
|
||||
run: bash build/build_appimage.sh
|
||||
- name: Pack release bundle
|
||||
run: |
|
||||
mkdir -p dist/release
|
||||
cp dist/TrulyMEM dist/release/
|
||||
cp dist/TrulyMEM.desktop dist/release/
|
||||
[ -f pic/image.png ] && cp pic/image.png dist/release/ || true
|
||||
tar -C dist/release -czf dist/TrulyMEM-linux-amd64.tar.gz .
|
||||
ls -lh dist/TrulyMEM-linux-amd64.tar.gz
|
||||
|
||||
- name: Upload binary artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: TrulyMEM-linux-${{ github.sha }}
|
||||
path: |
|
||||
dist/TrulyMEM
|
||||
dist/TrulyMEM.desktop
|
||||
dist/TrulyMEM.AppImage
|
||||
if-no-files-found: error
|
||||
retention-days: 30
|
||||
- name: Build AppImage if preinstalled
|
||||
run: |
|
||||
if command -v appimagetool >/dev/null 2>&1; then
|
||||
bash build/build_appimage.sh
|
||||
else
|
||||
echo "appimagetool not found on runner, skip AppImage build"
|
||||
fi
|
||||
|
||||
- name: Show build outputs
|
||||
run: |
|
||||
ls -lah dist/
|
||||
|
||||
- name: Create Gitea release
|
||||
if: startsWith(github.ref, 'refs/tags/')
|
||||
@ -83,9 +71,16 @@ jobs:
|
||||
run: |
|
||||
test -n "$GITEA_TOKEN"
|
||||
|
||||
release_payload=$(jq -n \
|
||||
--arg tag "$TAG_NAME" \
|
||||
'{tag_name:$tag, name:$tag, draft:false, prerelease:false}')
|
||||
release_payload=$(python3 - <<'PY'
|
||||
import json, os
|
||||
print(json.dumps({
|
||||
'tag_name': os.environ['TAG_NAME'],
|
||||
'name': os.environ['TAG_NAME'],
|
||||
'draft': False,
|
||||
'prerelease': False,
|
||||
}))
|
||||
PY
|
||||
)
|
||||
|
||||
release_response=$(curl -fsSL \
|
||||
-H "Authorization: token $GITEA_TOKEN" \
|
||||
@ -95,19 +90,32 @@ jobs:
|
||||
-d "$release_payload" \
|
||||
|| true)
|
||||
|
||||
release_id=$(printf '%s' "$release_response" | jq -r '.id // empty')
|
||||
release_id=$(RELEASE_RESPONSE="$release_response" python3 - <<'PY'
|
||||
import json, os
|
||||
raw = os.environ.get('RELEASE_RESPONSE', '').strip()
|
||||
if not raw:
|
||||
print('')
|
||||
else:
|
||||
try:
|
||||
print(json.loads(raw).get('id', ''))
|
||||
except Exception:
|
||||
print('')
|
||||
PY
|
||||
)
|
||||
|
||||
if [ -z "$release_id" ]; then
|
||||
release_id=$(curl -fsSL \
|
||||
-H "Authorization: token $GITEA_TOKEN" \
|
||||
"$SERVER_URL/api/v1/repos/$REPO/releases/tags/$TAG_NAME" | jq -r '.id')
|
||||
"$SERVER_URL/api/v1/repos/$REPO/releases/tags/$TAG_NAME" | python3 -c 'import json,sys; print(json.load(sys.stdin)["id"])')
|
||||
fi
|
||||
|
||||
for file in dist/TrulyMEM dist/TrulyMEM.desktop dist/TrulyMEM.AppImage; do
|
||||
name=$(basename "$file")
|
||||
curl -fsSL \
|
||||
-H "Authorization: token $GITEA_TOKEN" \
|
||||
-H "Content-Type: application/octet-stream" \
|
||||
--data-binary @"$file" \
|
||||
"$SERVER_URL/api/v1/repos/$REPO/releases/$release_id/assets?name=$name"
|
||||
for file in dist/TrulyMEM dist/TrulyMEM.desktop dist/TrulyMEM-linux-amd64.tar.gz dist/TrulyMEM.AppImage; do
|
||||
if [ -f "$file" ]; then
|
||||
name=$(basename "$file")
|
||||
curl -fsSL \
|
||||
-H "Authorization: token $GITEA_TOKEN" \
|
||||
-H "Content-Type: application/octet-stream" \
|
||||
--data-binary @"$file" \
|
||||
"$SERVER_URL/api/v1/repos/$REPO/releases/$release_id/assets?name=$name"
|
||||
fi
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user