我有一个github动作,当分支合并到master时运行。它应该使用从setup.py获得的版本号标记该存储库,然后按下该标记。然后,它应该构建软件包并将其上传到软件包存储库。
到目前为止的进展:构建和上传作品有效,但标记无效
name: Deploy Library
on [push]
jobs:
build:
runs-on: ubuntu latest
steps:
- uses: actions/checkout@master
- name: Set up Python env
uses: actions/setup-python@v1
with:
python-version: '3.6'
- name: Install Deps
run: |
python -m pip install --upgrade pip
pip install wheel
pip install twine
- name: Build
run: |
python setup.py build bdist_wheel
- name: Tag
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
VERSION=*sed magic on setup.py*
git tag v$VERSION
git push origin v$VERSION
除了末尾的git push之外,其他所有方法均有效。日志抱怨需要用户名和密码(我只有GITHUB_TOKEN),无论如何,操作/结帐都没有抱怨...
我已经检查了github操作页面,但找不到与标记相关的页面。
答案 0 :(得分:0)
actions/checkout@v1
操作使git存储库处于分离的HEAD状态。因此,要推回存储库,需要执行一些步骤。
为要成为提交作者的用户设置git config:
git config --global user.name 'My User'
git config --global user.email 'myuser@example.com'
设置遥控器:
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/username/repository
您可能还需要结帐。您可以从GITHUB_REF
中提取分支名称:
git checkout "${GITHUB_REF:11}"
相关问题和答案: