diff --git a/.github/workflows/PUBLISH.yml b/.github/workflows/PUBLISH.yml new file mode 100644 index 0000000..054a128 --- /dev/null +++ b/.github/workflows/PUBLISH.yml @@ -0,0 +1,97 @@ +name: Publish to PyPi and Bioconda + +on: + release: + types: [published] + workflow_dispatch: + inputs: + version: + description: 'Version string (e.g., 1.2.3)' + required: true + dry_run: + description: 'Dry Run (Skip PyPI publish and Bioconda PR)' + type: boolean + default: true + +jobs: + pypi-publish: + name: Build & Publish to PyPI + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/p/MMASeq + permissions: + contents: read + id-token: write # Required for PyPI Trusted Publishing (OIDC) + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.x' + + - name: Install build tool + run: python -m pip install build --user + + - name: Build sdist and wheel + run: python -m build + + - name: Publish package to PyPI + if: ${{ inputs.dry_run != true }} + uses: pypa/gh-action-pypi-publish@release/v1 + + - name: Report Build Success + if: ${{ inputs.dry_run == true }} + run: | + echo "DRY RUN MODE: Package built successfully!" + ls -la dist/ + + bioconda-update: + name: Update Bioconda Recipe & Open PR + needs: pypi-publish + runs-on: ubuntu-latest + + steps: + - name: Wait 5 minutes for PyPI indexing + run: | + echo "Waiting 5 minutes to ensure PyPI indexing and sha256 generation..." + sleep 300 + + - name: Checkout bioconda-recipes fork + uses: actions/checkout@v4 + with: + repository: ssi-dk/bioconda-recipes + ref: master + path: bioconda-recipes + + - name: Set up Miniconda + uses: conda-incubator/setup-miniconda@v3 + with: + auto-update-conda: true + activate-environment: bioconda-utils + environment-file: environment.yml + # If you don't want environment.yml, see next step for a pip/conda install approach + + - name: Install bioconda-utils + shell: bash + run: | + conda create -y -n bioconda-utils -c conda-forge -c bioconda --strict-channel-priority bioconda-utils + conda activate bioconda-utils + bioconda-utils --help + + - name: Run autobump for MMASeq recipe + shell: bash + env: + GITHUB_TOKEN: ${{ secrets.BIOCONDARECIPES }} + run: | + conda activate bioconda-utils + cd bioconda-recipes + + # config.yml lives at the bioconda-recipes root + # recipes/ is the directory containing recipes + bioconda-utils autobump recipes/ config.yml \ + --packages mmaseq \ + --create-pr