-
Notifications
You must be signed in to change notification settings - Fork 51
205 lines (199 loc) · 7.8 KB
/
tethys-release.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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
# Tethys Main CI
name: Tethys-CI
# Only run on tags.
on:
push:
tags:
- "*"
env:
CONDA_BUILD_PIN_LEVEL: minor
DOCKER_UPLOAD_URL: tethysplatform/tethys-core
jobs:
docker-build:
name: Docker Build (${{ matrix.platform }}, ${{ matrix.django-version }}, ${{ matrix.python-version }})
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest]
python-version: ["3.10", "3.11", "3.12"]
django-version: ["3.2", "4.2", "5.1"]
steps:
# Checkout the source
- name: Checkout Source
uses: actions/checkout@v4
with:
fetch-depth: 0
# Parse version parts from tag
- name: Parse version from tag
id: version
uses: release-kit/semver@v1
- name: Safe Tag
id: safetag
run: |
full_tag="${{ steps.version.outputs.full }}-py${{ matrix.python-version }}-dj${{ matrix.django-version }}";
# no "+" characters allowed in Docker tags
safe_tag="${full_tag//+/-}";
echo "safetag=$safe_tag" >> $GITHUB_OUTPUT;
echo $safe_tag;
- name: Log version
id: logversion
run: |
full_tag="${{ steps.version.outputs.full }}";
# no "+" characters allowed in Docker tags
safe_tag="${full_tag//+/-}";
echo "safetag=$safe_tag" >> $GITHUB_OUTPUT;
echo "Major: ${{ steps.version.outputs.major }}"
echo "Minor: ${{ steps.version.outputs.minor }}"
echo "Patch: ${{ steps.version.outputs.patch }}"
echo "Prerelease: ${{ steps.version.outputs.prerelease }}"
echo "Build: ${{ steps.version.outputs.build }}"
echo "Full: ${{ steps.version.outputs.full }}"
echo "Tag: ${{ steps.version.outputs.tag }}"
echo "Safe Tag: ${{ steps.safetag.outputs.safetag }}"
# Build the docker with version tag
- name: Build With Tag
run: |
full_tag="${{ steps.version.outputs.full }}";
# no "+" characters allowed in Docker tags
safe_tag="${full_tag//+/-}";
docker build -t ${{ env.DOCKER_UPLOAD_URL }}:"${{ steps.safetag.outputs.safetag }}" .;
# Authenticate docker
- name: Authenticate Docker
run: |
echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin;
# Upload docker
- name: Upload Docker With Tag
run: |
echo "Pushing to docker registry";
docker push ${{ env.DOCKER_UPLOAD_URL }}:${{ steps.safetag.outputs.safetag }};
conda-build:
name: Conda Build (${{ matrix.platform }})
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest]
# Checkout the source
steps:
- name: Checkout Source
uses: actions/checkout@v4
with:
fetch-depth: 0
# Parse version parts from tag
- name: Parse version from tag
id: version
uses: release-kit/semver@v1
- name: Safe Tag
id: safetag
run: |
full_tag="${{ steps.version.outputs.full }}";
# no "+" characters allowed in Docker tags
safe_tag="${full_tag//+/-}";
echo "safetag=$safe_tag" >> $GITHUB_OUTPUT;
echo $safe_tag;
- name: Log version
id: logversion
run: |
full_tag="${{ steps.version.outputs.full }}";
# no "+" characters allowed in Docker tags
safe_tag="${full_tag//+/-}";
echo "safetag=$safe_tag" >> $GITHUB_OUTPUT;
echo "Major: ${{ steps.version.outputs.major }}"
echo "Minor: ${{ steps.version.outputs.minor }}"
echo "Patch: ${{ steps.version.outputs.patch }}"
echo "Prerelease: ${{ steps.version.outputs.prerelease }}"
echo "Build: ${{ steps.version.outputs.build }}"
echo "Full: ${{ steps.version.outputs.full }}"
echo "Tag: ${{ steps.version.outputs.tag }}"
echo "Safe Tag: ${{ steps.safetag.outputs.safetag }}"
# Setup Tethys
- name: Setup Tethys
run: |
cd ..
bash ./tethys/scripts/install_tethys.sh --partial-tethys-install me -n tethys -s $PWD/tethys -x
. ~/miniconda/etc/profile.d/conda.sh
conda activate tethys
hash -r
conda config --set always_yes yes --set changeps1 no
conda update -q conda
# Export Conda Build Path
- name: Set Conda Build Path
run: |
echo "CONDA_BLD_PATH=/home/runner/conda-bld" >> $GITHUB_ENV
# Generate Conda Recipe With Constrained Dependencies
- name: Generate Conda Recipe
run: |
cd ..
. ~/miniconda/etc/profile.d/conda.sh;
conda activate tethys;
tethys gen metayaml -p ${CONDA_BUILD_PIN_LEVEL} --overwrite;
# Show Tethys Meta
- name: Show Tethys Meta
run: |
cd ..
cat ./tethys/conda.recipe/meta.yaml
# Build Conda
- name: Build Conda
run: |
cd ..
. ~/miniconda/etc/profile.d/conda.sh;
conda create -y -c conda-forge -n conda-build conda-build anaconda-client
conda activate conda-build
conda config --set anaconda_upload no
mkdir -p ~/conda-bld
conda-build -c tethysplatform -c conda-forge ./tethys/conda.recipe
# Upload to Anaconda Cloud
- name: Upload to Conda Release Channel
if: ${{ steps.version.outputs.prerelease == '' }}
run: |
cd ..
. ~/miniconda/etc/profile.d/conda.sh;
conda activate conda-build;
echo "Publishing to release channel...";
anaconda -t "${{ secrets.CONDA_UPLOAD_TOKEN }}" upload -u ${{ secrets.CONDA_UPLOAD_USER }} $CONDA_BLD_PATH/noarch/tethys-platform*.tar.bz2 --force;
- name: Upload to Conda Dev Channel
if: ${{ steps.version.outputs.prerelease != '' }}
run: |
cd ..
. ~/miniconda/etc/profile.d/conda.sh;
conda activate conda-build;
echo "Publishing to dev channel...";
anaconda -t "${{ secrets.CONDA_UPLOAD_TOKEN }}" upload -u ${{ secrets.CONDA_UPLOAD_USER }} -l dev $CONDA_BLD_PATH/noarch/tethys-platform*.tar.bz2 --force;
# BUILD micro-tethys-platform
# Generate Conda Recipe With Constrained Dependencies
- name: Generate Conda Recipe - micro
run: |
cd ..
. ~/miniconda/etc/profile.d/conda.sh;
conda activate tethys;
tethys gen metayaml -p ${CONDA_BUILD_PIN_LEVEL} --micro --overwrite;
# Show Tethys Meta
- name: Show Tethys Meta - micro
run: |
cd ..
cat ./tethys/conda.recipe/meta.yaml
# Build Conda
- name: Build Conda - micro
run: |
cd ..
. ~/miniconda/etc/profile.d/conda.sh;
conda activate conda-build
conda-build -c tethysplatform -c conda-forge ./tethys/conda.recipe
# Upload to Anaconda Cloud
- name: Upload to Conda Release Channel - micro
if: ${{ steps.version.outputs.prerelease == '' }}
run: |
cd ..
. ~/miniconda/etc/profile.d/conda.sh;
conda activate conda-build;
echo "Publishing to release channel...";
anaconda -t "${{ secrets.CONDA_UPLOAD_TOKEN }}" upload -u ${{ secrets.CONDA_UPLOAD_USER }} $CONDA_BLD_PATH/noarch/micro-tethys-platform*.tar.bz2 --force;
- name: Upload to Conda Dev Channel - micro
if: ${{ steps.version.outputs.prerelease != '' }}
run: |
cd ..
. ~/miniconda/etc/profile.d/conda.sh;
conda activate conda-build;
echo "Publishing to dev channel...";
anaconda -t "${{ secrets.CONDA_UPLOAD_TOKEN }}" upload -u ${{ secrets.CONDA_UPLOAD_USER }} -l dev $CONDA_BLD_PATH/noarch/micro-tethys-platform*.tar.bz2 --force;