Skip to content

Commit

Permalink
try and fix gh action
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasCARPi committed Dec 9, 2022
1 parent 85af0e1 commit b0ef756
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
9 changes: 3 additions & 6 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
12 changes: 12 additions & 0 deletions helper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -38,4 +45,9 @@ function publish {
cd ..
}

function build-ci {
generate-ci
build
}

"$1"

0 comments on commit b0ef756

Please sign in to comment.