forked from NASA-Openscapes/corn
-
Notifications
You must be signed in to change notification settings - Fork 0
66 lines (59 loc) · 1.8 KB
/
build-nmfs.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
name: Build and push Docker image
on:
push:
tags:
- 'v*'
jobs:
build-and-push-docker:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v2
- uses: conda-incubator/setup-miniconda@v2
with:
python-version: "3.10"
channels: conda-forge
miniforge-variant: Mambaforge
environment-file: ci/environment-lock.yml
activate-environment: env-lock
- name: "Create conda-locks"
working-directory: ./ci
run: |
find environments -mindepth 1 -maxdepth 1 -type d | xargs -I % sh -c "cd %; conda-lock -k explicit -f environment.yml"
- name: "Set Job Environment Variables"
run: |
SHA7="${GITHUB_SHA::7}"
DOCKER_TAG=$SHA7
echo $DOCKER_TAG > docker-tag.txt
echo "DOCKER_TAG=${DOCKER_TAG}" >> $GITHUB_ENV
- name: Upload docker tag
uses: actions/upload-artifact@v3
with:
name: docker-tag
path: docker-tag.txt
- name: "Build and Publish to DockerHub"
uses: elgohr/Publish-Docker-Github-Action@2.12
with:
name: openscapes/nmfsdatasci
username: openscapes
password: ${{ secrets.DOCKERHUB_TOKEN }}
workdir: ci
tags: "main, ${{env.DOCKER_TAG}}"
- name: Export Full Conda Environment
run: |
docker run openscapes/python:main conda list --export
update-hub-image:
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
needs: build-and-push-docker
steps:
- name: get docker tag
uses: actions/download-artifact@v3
with:
name: docker-tag
- shell: bash
run: |
DOCKER_TAG=`cat docker-tag.txt`
echo "DOCKER_TAG=${DOCKER_TAG}" >> $GITHUB_ENV