diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index c8826a6..351df1b 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -15,19 +15,16 @@ jobs: steps: - uses: actions/checkout@v2 - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v3 with: python-version: '3.x' - name: Install dependencies run: | python -m pip install --upgrade pip pip install setuptools wheel twine - - name: Generate library + - name: Generate and build the library run: | - bash helper.sh generate - - name: Build - run: | - bash helper.sh build + bash helper.sh build-ci - name: Publish to PyPI uses: pypa/gh-action-pypi-publish@master with: diff --git a/helper.sh b/helper.sh index 97853c8..1c41f7e 100755 --- a/helper.sh +++ b/helper.sh @@ -18,6 +18,13 @@ function generate { docker run --user "$(id -u)":"$(id -gn)" --rm -v "${PWD}":/local "$docker_image" generate -i "$openapi_yaml_url" -l python -o /local/"$lib" -c /local/config.json --git-user-id elabftw --git-repo-id elabapi-python } +# don't use user/group ids in GH actions +function generate-ci { + docker run --rm -v "${PWD}":/local "$docker_image" generate -i "$openapi_yaml_url" -l python -o /local/"$lib" -c /local/config.json --git-user-id elabftw --git-repo-id elabapi-python + # fix permissions + chown -R "$(id -u)":"$(id -gn)" "$lib" +} + # generate the lib from a local file in current directory function generate-from-local { cleanup @@ -38,4 +45,9 @@ function publish { cd .. } +function build-ci { + generate-ci + build +} + "$1"