magictk/.gitea/workflows/build.yaml

52 lines
2.0 KiB
YAML

name: Build and Publish
run-name: Build and Publish Package (${{ gitea.actor }})
on: [push, workflow_dispatch, pull_request]
jobs:
Run:
runs-on: ubuntu-latest
steps:
- name: Info
run: echo "OS=${{ runner.os }} NAME=${{ gitea.event_name }} REPO=${{ gitea.repository }} BRANCH=${{ gitea.ref }} ST=${{ job.status }} RUNID=${{ gitea.run_id }}"
- name: Prepare Source
run: |
echo "--- write source ---"
echo "deb http://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free">/etc/apt/sources.list
echo "deb http://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free">>/etc/apt/sources.list
echo "deb http://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free">>/etc/apt/sources.list
cat /etc/apt/sources.list
rm -rf /etc/apt/sources.list.d/*
echo "--- update source ---"
apt-get update
- name: Prepare Python
run: |
apt-get install python3-pip -y
python3 -m pip install setuptools wheel twine -i https://pypi.tuna.tsinghua.edu.cn/simple
- name: CheckOut
uses: http://git.hmtsai.cn/actions/checkout@v4
- name: Write Config
run: |
echo "${{ gitea.run_id }}">runid.conf
- name: Build
run: python3 setup.py sdist bdist_wheel
- name: Check
run: |
echo "pwd:"
pwd
echo "File list:"
ls
echo "Publish list:"
ls dist
- name: Publish Gitea
env:
TWINE_REPOSITORY_URL: "${{ secrets.PKG_GITEA_URL }}/api/packages/${{ secrets.PKG_GITEA_USERNAME }}/pypi"
TWINE_USERNAME: ${{ secrets.PKG_GITEA_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PKG_GITEA_KEY }}
run: |
twine upload dist/* --verbose --disable-progress-ba
- name: Publish Pypi
env:
TWINE_PASSWORD: ${{ secrets.PYPI_KEY }}
run: |
twine upload dist/* --verbose --disable-progress-ba