-
Notifications
You must be signed in to change notification settings - Fork 0
160 lines (152 loc) · 6.41 KB
/
pins.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
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