-
Notifications
You must be signed in to change notification settings - Fork 179
179 lines (155 loc) · 5.68 KB
/
github-release.yml
File metadata and controls
179 lines (155 loc) · 5.68 KB
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
name: Github Actions - Build Anaconda Release
env:
ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_TOKEN }}
ENCRYPTION_KEY: ${{ secrets.KDU_ENC_KEY }}
on:
workflow_dispatch:
release:
types: [prereleased, released]
push:
branches:
- '*.*.*_RC*'
- '*.*.*_LTS'
jobs:
build:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-15, macos-15-intel]
runs-on: ${{ matrix.os }}
outputs:
isis_version: ${{ steps.set_version.outputs.isis_version }}
steps:
- uses: actions/checkout@v4
- name: Set ISIS_VERSION
id: set_version
run: echo "isis_version=${{ github.event.release.tag_name || github.ref_name }}" >> "$GITHUB_OUTPUT"
- name: Set up Mambaforge
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-variant: Miniforge3
auto-update-conda: true
use-mamba: true
- name: Build Release
env:
ISIS_VERSION: ${{ steps.set_version.outputs.isis_version }}
run: |
mamba install conda-build anaconda-client
git fetch origin
if [[ "$ISIS_VERSION" =~ .*_RC[0-9]$ ]]; then
git checkout $ISIS_VERSION
else
git checkout refs/tags/$ISIS_VERSION
fi
cd recipe
if [[ "$ISIS_VERSION" =~ .*_RC[0-9]$ ]]; then
conda build . -c usgs-astrogeology -c conda-forge --override-channels --user usgs-astrogeology --label RC
elif [[ "$ISIS_VERSION" =~ .*_LTS$ ]]; then
conda build . -c usgs-astrogeology -c conda-forge --override-channels --user usgs-astrogeology --label LTS
else
conda build . -c usgs-astrogeology -c conda-forge --override-channels --user usgs-astrogeology --label LTS --label main
fi
test:
runs-on: ${{ matrix.os }}
needs: build
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-15, macos-15-intel]
env:
ISIS_VERSION: ${{ needs.build.outputs.isis_version }}
steps:
- name: Set up Miniforge
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-variant: Miniforge3
auto-update-conda: true
activate-environment: isis-test
use-mamba: true
- name: Conda install and test spiceinit
run: |
source "${CONDA}/etc/profile.d/conda.sh"
conda activate isis-test
if [[ "$ISIS_VERSION" =~ .*_RC[0-9]$ ]]; then
conda install -c conda-forge -c usgs-astrogeology usgs-astrogeology/label/RC::isis=${ISIS_VERSION} -y
elif [[ "$ISIS_VERSION" =~ .*_LTS$ ]]; then
conda install -c conda-forge -c usgs-astrogeology usgs-astrogeology/label/LTS::isis=${ISIS_VERSION} -y
else
conda install -c conda-forge -c usgs-astrogeology isis=${ISIS_VERSION} -y
fi
export ISISROOT=$CONDA_PREFIX
conda list isis
spiceinit -h
docs:
name: Build and Upload ISIS Public Release Docs
runs-on: ubuntu-latest
needs: test
env:
ISIS_VERSION: ${{ needs.build.outputs.isis_version }}
if: |
success() &&
!contains(needs.build.outputs.isis_version, '_RC') &&
!contains(needs.build.outputs.isis_version, '_LTS')
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Conda for doc build
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-variant: Miniforge3
auto-update-conda: true
environment-file: environment.yml
activate-environment: isis
use-mamba: true
- name: Build documentation
run: |
source "${CONDA}/etc/profile.d/conda.sh"
conda activate isis
mkdir build && cd build
export ISISROOT=$(pwd)
cmake -GNinja ../isis
ninja docs
- name: Set AWS credentials for upload
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-west-2
- name: Upload to S3
run: |
cd /home/runner/work/ISIS3/ISIS3/build/docs
if [ -d "${ISIS_VERSION}" ]; then
cd "${ISIS_VERSION}"
echo "Uploading documentation to S3..."
aws s3 sync ./ s3://asc-public-docs/isis-site/${ISIS_VERSION}/ --delete
aws s3 cp s3://asc-public-docs/isis-site/versions.json ./versions.json
else
echo "Error: docs/${ISIS_VERSION} directory not found!"
exit 1
fi
- name: Update versions.json
shell: python
env:
ISIS_VERSION: ${{ env.ISIS_VERSION }}
run: |
import json
from packaging.version import parse
import os
new_version = os.environ["ISIS_VERSION"]
with open("versions.json") as f:
versions = json.load(f)
non_dev = [v for v in versions if v != "Dev" and v.strip() != ""]
if new_version not in non_dev:
non_dev.append(new_version)
non_dev_sorted = sorted(non_dev, key=parse, reverse=True)
updated_versions = ["Dev"] + non_dev_sorted
if updated_versions != versions:
with open("versions.json", "w") as f:
json.dump(updated_versions, f)
print("versions.json updated:", updated_versions)
else:
print("No changes needed to versions.json")
- name: Upload updated versions.json to S3
run: |
aws s3 cp ./versions.json s3://asc-public-docs/isis-site/versions.json