Merge pull request #417 from ssec/snyk-fix-cab1c3cdc8f114133de7be4740… #217
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy | |
# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#concurrency | |
# https://docs.github.com/en/developers/webhooks-and-events/events/github-event-types#pullrequestevent | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.number }}-${{ github.event.type }} | |
cancel-in-progress: true | |
on: | |
pull_request: | |
push: | |
branches: | |
- master | |
release: | |
types: | |
- published | |
jobs: | |
sdist: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source | |
uses: actions/checkout@v4 | |
- name: Create sdist | |
shell: bash -l {0} | |
run: python3 -m pip install build; python -m build | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: dist | |
path: dist/*.tar.gz | |
bundle: | |
runs-on: ${{ matrix.os }} | |
defaults: | |
run: | |
shell: "bash -l {0}" | |
continue-on-error: false | |
strategy: | |
fail-fast: true | |
matrix: | |
os: ["windows-latest", "ubuntu-latest", "macos-latest"] | |
python-version: ["3.11"] | |
env: | |
PYTHON_VERSION: ${{ matrix.python-version }} | |
OS: ${{ matrix.os }} | |
ACTIONS_ALLOW_UNSECURE_COMMANDS: true | |
steps: | |
- name: Checkout source | |
uses: actions/checkout@v4 | |
- name: Install SSH Key | |
uses: shimataro/ssh-key-action@v2 | |
# only upload on push (currently only master), otherwise SFTP key is not needed | |
if: github.event_name == 'push' | |
with: | |
key: ${{ secrets.SIFT_SFTP_UPLOAD_KEY }} | |
name: id_rsa_sftp | |
known_hosts: ${{ secrets.SIFT_SFTP_UPLOAD_KNOWN_HOSTS }} | |
- name: Setup Conda Environment | |
uses: conda-incubator/setup-miniconda@v3 | |
with: | |
miniforge-variant: Mambaforge | |
miniforge-version: latest | |
use-mamba: true | |
environment-file: continuous_integration/environment.yaml | |
activate-environment: test-environment | |
- name: Install conda pack | |
run: | | |
conda install conda-pack curl | |
curl -V | |
- name: Install uwsift | |
run: | | |
pip install --no-deps . | |
- name: Build bundle | |
run: | | |
continuous_integration/build_conda_pack.sh | |
# It would be better to only upload if all platforms had succeeded but | |
# that would require uploading the bundles as artifacts which would | |
# quickly hit our temporary storage limits | |
- name: Upload bundle | |
# only upload on push (currently only master) | |
if: github.event_name == 'push' | |
run: | | |
continuous_integration/upload_conda_pack.sh | |
upload-sdist: | |
runs-on: ubuntu-latest | |
needs: [sdist, bundle] # don't deploy unless sdist and bundle building succeeded | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: dist | |
path: dist | |
- uses: pypa/gh-action-pypi-publish@master | |
# publish when a GitHub Release is created | |
if: github.event_name == 'release' && github.event.action == 'published' | |
with: | |
user: __token__ | |
password: ${{ secrets.UWSIFT_PYPI_TOKEN }} |