magictk/.gitea/workflows/build.yaml

55 lines
2.1 KiB
YAML
Raw Normal View History

2024-04-15 21:58:14 +08:00
name: Build and Publish
run-name: Build and Publish Package (${{ gitea.actor }})
2024-04-17 22:46:34 +08:00
on: [push, workflow_dispatch, pull_request]
2024-04-15 21:58:14 +08:00
jobs:
Run:
runs-on: ubuntu-latest
2024-04-16 21:47:07 +08:00
environment:
name: pypi
url: https://pypi.org/p/<your-pypi-project-name>
2024-04-15 21:58:14 +08:00
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 }}"
2024-04-15 22:16:02 +08:00
- name: Prepare Source
run: |
2024-04-15 22:20:10 +08:00
echo "--- write source ---"
2024-04-15 22:16:02 +08:00
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
2024-04-17 06:45:33 +08:00
rm -rf /etc/apt/sources.list.d/*
2024-04-16 21:47:07 +08:00
echo "--- update source ---"
2024-04-15 22:20:10 +08:00
apt-get update
2024-04-15 22:01:59 +08:00
- name: Prepare Python
2024-04-15 22:08:52 +08:00
run: |
2024-04-15 22:20:10 +08:00
apt-get install python3-pip -y
2024-04-16 21:51:45 +08:00
python3 -m pip install setuptools wheel twine -i https://pypi.tuna.tsinghua.edu.cn/simple
2024-04-15 21:58:14 +08:00
- name: CheckOut
2024-04-15 22:01:59 +08:00
uses: http://hmtsai.cn:3000/actions/checkout@v4
- name: Write Config
run: |
echo "${{ gitea.run_id }}">runid.conf
2024-04-15 21:58:14 +08:00
- name: Build
2024-04-16 22:35:58 +08:00
run: python3 setup.py sdist bdist_wheel
2024-04-16 21:54:44 +08:00
- name: Check
run: |
echo "pwd:"
pwd
echo "File list:"
ls
2024-04-16 22:02:53 +08:00
echo "Publish list:"
2024-04-16 22:09:38 +08:00
ls dist
2024-04-18 21:12:58 +08:00
- name: Publish Gitea
env:
2024-04-18 21:15:12 +08:00
TWINE_REPOSITORY_URL: "https://${{ secrets.PKG_GITEA_URL }}/api/packages/${{ secrets.PKG_GITEA_USERNAME }}/pypi"
2024-04-18 21:12:58 +08:00
TWINE_USERNAME: ${{ secrets.PKG_GITEA_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PKG_GITEA_KEY }}
run: |
twine upload dist/* --verbose --disable-progress-ba
- name: Publish Pypi
2024-04-16 21:47:07 +08:00
env:
2024-04-16 22:35:58 +08:00
TWINE_PASSWORD: ${{ secrets.PYPI_KEY }}
2024-04-16 21:47:07 +08:00
run: |
2024-04-18 21:12:58 +08:00
twine upload dist/* --verbose --disable-progress-barr