From 0f69ec1a554a9d3719f448ff4ef3b4f46374d1f2 Mon Sep 17 00:00:00 2001 From: tmaeno Date: Thu, 2 Nov 2023 10:23:16 +0100 Subject: [PATCH] * added reload_input to pbook * added memory warning and -y to pathena/prun --- .github/workflows/condapublish.yml | 82 +++++++++++++++++++++++++++++ .github/workflows/pythonpublish.yml | 40 ++++++++++++++ 2 files changed, 122 insertions(+) create mode 100644 .github/workflows/condapublish.yml create mode 100644 .github/workflows/pythonpublish.yml diff --git a/.github/workflows/condapublish.yml b/.github/workflows/condapublish.yml new file mode 100644 index 00000000..4e0fe866 --- /dev/null +++ b/.github/workflows/condapublish.yml @@ -0,0 +1,82 @@ +# This is a basic workflow to help you get started with Actions + +name: Publish on Conda-forge + +# Controls when the workflow will run +on: + + release: + types: [ published ] + + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + publish: + # The type of runner that the job will run on + runs-on: ubuntu-latest + + # variables + env: + REPO_NAME: ${{ github.event.repository.name }} + OWNER_NAME: ${{ github.repository_owner }} + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Check-out src repository + - uses: actions/checkout@v3 + with: + path: src + + # Check-out feedstock + - uses: actions/checkout@v2 + with: + token: ${{ secrets.PAT_GITHUB }} + repository: ${{ github.repository_owner }}/${{ github.event.repository.name }}-feedstock + path: dst + + # Re-sync + - name: Re-sync + run: | + cd dst + git remote add upstream https://github.com/conda-forge/${REPO_NAME}-feedstock.git + git fetch upstream + git checkout main + git merge upstream/main + + # Generate meta.yaml + - name: Generate and push meta.yaml + run: | + PACKAGE_NAME=`echo $REPO_NAME | sed -e 's/-//g'` + cd src/${PACKAGE_NAME} + VERSION=`python -c 'exec(open("PandaToolsPkgInfo.py").read());print (release_version)'` + cd - + echo REPO_NAME=$REPO_NAME + echo "REPO_NAME=$REPO_NAME" >> $GITHUB_ENV + echo PACKAGE_NAME=$PACKAGE_NAME + echo VERSION=$VERSION + echo "VERSION=$VERSION" >> $GITHUB_ENV + wget https://github.com/${OWNER_NAME}/${REPO_NAME}/archive/refs/tags/${VERSION}.tar.gz -q -O dummy.tar.gz + SHA256SUM=`sha256sum dummy.tar.gz` + SHA256SUM=${SHA256SUM% *} + echo SHA256SUM=$SHA256SUM + sed -e "s/___PACKAGE_VERSION___/${VERSION}/g" src/templates/conda_meta.yaml.template \ + | sed -e "s/___SHA256SUM___/${SHA256SUM}/g" > dst/recipe/meta.yaml + + - name: Push the change + run: | + cd dst + # use personal info since github-actions/github-actions@github.com doesn't work for forked repos + git config --global user.name 'Tadashi Maeno' + git config --global user.email 'tmaeno@bnl.gov' + git diff --quiet && git diff --staged --quiet || git commit -am "${VERSION} github action" + git push + + - name: Request pull request + env: + # use PAT instead of GITHUB_TOKEN since the latter cannot submit a PR + GITHUB_TOKEN: ${{ secrets.PAT_GITHUB }} + run: | + cd dst + gh pr create -t "${REPO_NAME} ${VERSION} github action" -b "automatic pull request" diff --git a/.github/workflows/pythonpublish.yml b/.github/workflows/pythonpublish.yml new file mode 100644 index 00000000..9e8f510e --- /dev/null +++ b/.github/workflows/pythonpublish.yml @@ -0,0 +1,40 @@ +name: Upload Python Package + +on: + release: + types: [published] + workflow_dispatch: + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.x' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip setuptools wheel + python -m pip install hatch twine build + python -m pip list + + - name: Build a sdist + run: | + python -m build -s + cp packages/light/pyproject.toml . + hatch build -t wheel + + - name: Verify the distribution + run: twine check dist/* + + - name: Publish distribution to PyPI + if: github.event_name == 'release' && github.event.action == 'published' && github.repository == 'PanDAWMS/panda-client' + uses: pypa/gh-action-pypi-publish@release/v1 + with: + password: ${{ secrets.PYPI_API_TOKEN }}