Pins #4189
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: Pins | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
workflow_dispatch: | |
schedule: | |
- cron: "20 * * * *" # Every 1h | |
concurrency: | |
# Concurrency group that uses the workflow name and PR number if available | |
# or commit SHA as a fallback. If a new build is triggered under that | |
# concurrency group while a previous build is running it will be canceled. | |
# Repeated pushes to a PR will cancel all previous builds, while multiple | |
# merges to main will not cancel. | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} | |
cancel-in-progress: true | |
jobs: | |
prepare: | |
runs-on: ubuntu-latest | |
outputs: | |
versions: ${{ steps.args.outputs.versions }} | |
steps: | |
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
- name: Get arguments | |
id: args | |
run: echo "versions=$(ls versions | jq -Rsc 'split("\n")[:-1]')" >> $GITHUB_OUTPUT | |
build-conda-subchannel: | |
needs: [prepare] | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
napari-version: ${{ fromJson(needs.prepare.outputs.versions) }} | |
outputs: | |
subchannel-prefix: napari- | |
subdirs: ${{ steps.args.outputs.subdirs-json }} | |
versions: ${{ needs.prepare.outputs.versions }} | |
lastmodtime: ${{ steps.current-time.outputs.formattedTime }} | |
steps: | |
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
- name: Get arguments | |
id: args | |
run: | | |
echo "prune=$(jq -r '."prune" | join(" ")' versions/${{ matrix.napari-version }}/conda.json)" >> $GITHUB_OUTPUT | |
echo "subdirs-json=$(jq -c '.subdirs' versions/${{ matrix.napari-version }}/conda.json)" >> $GITHUB_OUTPUT | |
echo "subdirs=$(jq -r '.subdirs | join(" ")' versions/${{ matrix.napari-version }}/conda.json)" >> $GITHUB_OUTPUT | |
echo "subchannel-name=napari-${{ matrix.napari-version }}" >> $GITHUB_OUTPUT | |
- uses: conda-incubator/conda-subchannel@main | |
id: subchannel | |
with: | |
subchannel-name: ${{ steps.args.outputs.subchannel-name }} | |
channel: conda-forge | |
subdirs: ${{ steps.args.outputs.subdirs }} | |
prune-specs: ${{ steps.args.outputs.prune }} | |
gh-pages-branch: "" # Disable so we do it manually below | |
served-at: "https://github.com/napari/pins/releases/download/${{ steps.args.outputs.subchannel-name }}" | |
- name: Get current time | |
uses: josStorer/get-current-time@060cae3fbd32c181c6841788189a601ac8df8389 # v2.1.2 | |
id: current-time | |
with: | |
format: "YYYY-MM-DD HH:MM:SS" | |
utcOffset: "+00:00" | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: conda-${{ steps.args.outputs.subchannel-name }} | |
path: ${{ steps.subchannel.outputs.output-directory }} | |
build-pypi-constraints: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: pypi-napari-allversions | |
path: versions/*/*.txt | |
publish-website: | |
runs-on: ubuntu-latest | |
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || github.ref == 'refs/heads/main' | |
needs: [build-conda-subchannel, build-pypi-constraints] | |
permissions: | |
contents: write # to deploy to GH Pages | |
steps: | |
- name: Retrieve release distributions | |
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 | |
with: | |
pattern: "*-napari-*" | |
- name: List artifacts | |
run: tree -sh | |
- name: Arrange directories | |
run: | | |
mkdir -p conda pypi | |
for d in conda-*/; do | |
mv $d conda/${d:6} | |
done | |
for d in pypi-napari-allversions/*; do | |
mv $d pypi/napari-$(basename $d) | |
done | |
rm -rf pypi-napari-allversions | |
- name: List website files | |
run: tree -sh | |
- uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4.0.0 | |
with: | |
github_token: ${{ github.token }} | |
publish_branch: gh-pages | |
publish_dir: ./ | |
user_name: "github-actions[bot]" | |
user_email: "github-actions[bot]@users.noreply.github.com" | |
enable_jekyll: false | |
exclude_assets: ".github,**.json,**.bz2,**.zst" | |
keep_files: false | |
force_orphan: true | |
publish-repodata: | |
runs-on: ubuntu-latest | |
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || github.ref == 'refs/heads/main' | |
needs: [build-conda-subchannel] | |
permissions: | |
contents: write # to deploy to GH Releases | |
strategy: | |
matrix: | |
subdir: ${{ fromJson(needs.build-conda-subchannel.outputs.subdirs) }} | |
version: ${{ fromJson(needs.build-conda-subchannel.outputs.versions) }} | |
steps: | |
- name: Retrieve release distributions | |
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 | |
with: | |
name: "conda-${{ needs.build-conda-subchannel.outputs.subchannel-prefix }}${{ matrix.version }}" | |
- name: List repodata files | |
run: ls -alh ${{ matrix.subdir }}/repodata.* | |
- name: Upload conda repodata for ${{ matrix.subdir }} | |
uses: softprops/action-gh-release@69320dbe05506a9a39fc8ae11030b214ec2d1f87 # v2.0.5 | |
with: | |
draft: false | |
name: ${{ needs.build-conda-subchannel.outputs.subchannel-prefix }}${{ matrix.version }}/${{ matrix.subdir }} | |
tag_name: ${{ needs.build-conda-subchannel.outputs.subchannel-prefix }}${{ matrix.version }}/${{ matrix.subdir }} | |
files: | | |
${{ matrix.subdir }}/*.json | |
${{ matrix.subdir }}/*.json.bz2 | |
${{ matrix.subdir }}/*.json.zst | |
fail_on_unmatched_files: true | |
body: | | |
Repodata for `${{ needs.build-conda-subchannel.outputs.subchannel-prefix }}${{ matrix.version }}/${{ matrix.subdir }}` subchannel. | |
Last updated on ${{ needs.build-conda-subchannel.outputs.lastmodtime }} UTC. | |
See the README for more information. | |
keepalive-job: | |
name: Keep workflow alive | |
runs-on: ubuntu-latest | |
if: github.event_name != 'pull_request' | |
permissions: | |
actions: write | |
steps: | |
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 | |
- uses: gautamkrishnar/keepalive-workflow@05456e7809058d586d96392e99217726ccc10076 # v2.0.5 |