[action] merge isis-asp jobs #59
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
# Build and publish container images | |
# | |
# There are three images in this repo we want to build and publish individually: | |
# - GISPy | |
# - ISIS | |
# - ASP | |
# | |
# The images should be tagged as 'latest' and "$VERSION", where the version | |
# will point unequivocally to a git commit/tag of this repo. | |
# 'latest' will be the latest version of repository in 'stable' branch. | |
# | |
# Reference docs: | |
# - docs.github.com/en/actions/publishing-packages/publishing-docker-images | |
name: Build and Publish Containers | |
# Controls when the action will run. Triggers the workflow on push request, or repository dispatch | |
on: | |
# Runs when pushing to 'stable' branch | |
push: | |
# branches: | |
# - 'stable' | |
# - 'test' | |
branches-ignore: | |
- 'master' | |
tags: | |
- '*' | |
# Run in every PR too | |
pull_request: | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
# gispy: | |
# uses: ./.github/workflows/workflow_build.yml | |
# with: | |
# image_name: ${{ vars.DOCKERHUB_USERNAME }}/jupyter-gispy | |
# context_path: ./dockerfiles | |
# dockerfile_path: ./dockerfiles/gispy.dockerfile | |
# secrets: inherit | |
# isis: | |
# uses: ./.github/workflows/workflow_build.yml | |
# with: | |
# image_name: ${{ vars.DOCKERHUB_USERNAME }}/jupyter-isis | |
# context_path: ./dockerfiles | |
# dockerfile_path: ./dockerfiles/isis.dockerfile | |
# secrets: inherit | |
gispy: | |
runs-on: ubuntu-latest | |
env: | |
USER_ORG: ${{ vars.DOCKERHUB_USERNAME }} | |
SERVICE: jupyter-gispy | |
REPO: ${USER_ORG}/${SERVICE} | |
steps: | |
- # https://github.com/marketplace/actions/checkout | |
name: Checkout | |
uses: actions/checkout@v4 | |
- name: Build image | |
run: | | |
docker compose build ${{ env.SERVICE }} | |
- name: Tag image | |
if: ${{ github.event_name == 'push' }} | |
run: | | |
NEW_IMAGE=`docker compose config --images ${{ env.SERVICE }}` | |
docker tag $NEW_IMAGE ${{ env.REPO }}:$GITHUB_REF_NAME | |
- name: Tag 'latest' image | |
if: ${{ github.ref_type == 'tag' }} | |
run: | | |
NEW_IMAGE=`docker compose config --images ${{ env.SERVICE }}` | |
docker tag $NEW_IMAGE ${{ env.REPO }}:latest | |
# DATE=`date +%Y%m%d` | |
# docker tag $NEW_IMAGE ${{ env.REPO }}:$DATE | |
# - name: Tag image with SHA hash | |
# if: ${{ github.event_name == 'push' }} | |
# run: | | |
# IMAGE_SHA=`docker images -q $NEW_IMAGE` | |
# docker tag $NEW_IMAGE ${USERNAME}/jupyter-gispy:$IMAGE_SHA | |
- # https://github.com/marketplace/actions/docker-login | |
name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Push image | |
run: > | |
docker image ls | |
| tail -n+2 | awk '{print $1":"$2}' | |
| grep "${{ env.REPO }}" | |
| xargs -I'{}' docker push {} | |
isis: | |
runs-on: ubuntu-latest | |
env: | |
USER_ORG: ${{ vars.DOCKERHUB_USERNAME }} | |
SERVICE: jupyter-isis | |
REPO: ${USER_ORG}/${SERVICE} | |
steps: | |
- # https://github.com/marketplace/actions/checkout | |
name: Checkout | |
uses: actions/checkout@v4 | |
- name: Load .env file | |
uses: xom9ikk/dotenv@v2 | |
- name: Build image | |
run: | | |
docker compose build ${{ env.SERVICE }} | |
- name: Tag image | |
if: ${{ github.event_name == 'push' }} | |
run: | | |
NEW_IMAGE=`docker compose config --images ${{ env.SERVICE }}` | |
docker tag $NEW_IMAGE ${{ env.REPO }}:$GITHUB_REF_NAME | |
- name: Tag 'latest' image | |
if: ${{ github.ref_type == 'tag' }} | |
run: | | |
NEW_IMAGE=`docker compose config --images ${{ env.SERVICE }}` | |
docker tag $NEW_IMAGE ${{ env.REPO }}:latest | |
docker tag $NEW_IMAGE ${{ env.REPO }}:${ISIS_VERSION} | |
# DATE=`date +%Y%m%d` | |
# docker tag $NEW_IMAGE ${{ env.REPO }}:$DATE | |
# - name: Tag image with SHA hash | |
# if: ${{ github.event_name == 'push' }} | |
# run: | | |
# IMAGE_SHA=`docker images -q $NEW_IMAGE` | |
# docker tag $NEW_IMAGE ${USERNAME}/jupyter-gispy:$IMAGE_SHA | |
- # https://github.com/marketplace/actions/docker-login | |
name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Push image | |
run: > | |
docker image ls | |
| tail -n+2 | awk '{print $1":"$2}' | |
| grep "${{ env.REPO }}" | |
| xargs -I'{}' docker push {} | |
# - name: Save image | |
# run: | | |
# NEW_IMAGE=`docker compose config --images ${{ env.SERVICE }}` | |
# docker save --output /tmp/image.tar $NEW_IMAGE | |
# - name: Upload artifact | |
# uses: actions/upload-artifact@v3 | |
# with: | |
# name: isis_image | |
# path: /tmp/image.tar | |
# - name: List images | |
# run: | | |
# docker image ls -a | |
# isis-asp: | |
# needs: isis | |
# runs-on: ubuntu-latest | |
# env: | |
# USER_ORG: ${{ vars.DOCKERHUB_USERNAME }} | |
# SERVICE: jupyter-isis-asp | |
# REPO: ${USER_ORG}/${SERVICE} | |
# steps: | |
# - # https://github.com/marketplace/actions/checkout | |
# name: Checkout | |
# uses: actions/checkout@v4 | |
# - name: Download artifact | |
# uses: actions/download-artifact@v3 | |
# with: | |
# name: isis_image | |
# path: /tmp | |
# - name: Load image | |
# run: | | |
# docker load --input /tmp/image.tar | |
# docker image ls -a | |
# - name: Load .env file | |
# uses: xom9ikk/dotenv@v2 | |
- name: Redefine ENV for isis-asp | |
run: | | |
SERVICE="${{ env.SERVICE }}-asp" | |
REPO="${{ env.USER_ORG }}/$SERVICE" | |
echo "SERVICE=$SERVICE" >> $GITHUB_ENV | |
echo "REPO=$REPO" >> $GITHUB_ENV | |
- name: Build image | |
run: | | |
docker compose build ${SERVICE} | |
# docker compose build ${{ env.SERVICE }} | |
- name: Tag image | |
if: ${{ github.event_name == 'push' }} | |
run: | | |
NEW_IMAGE=`docker compose config --images ${SERVICE}` | |
docker tag $NEW_IMAGE ${REPO}:$GITHUB_REF_NAME | |
# NEW_IMAGE=`docker compose config --images ${{ env.SERVICE }}` | |
# docker tag $NEW_IMAGE ${{ env.REPO }}:$GITHUB_REF_NAME | |
- name: Tag 'latest' image | |
if: ${{ github.ref_type == 'tag' }} | |
run: | | |
NEW_IMAGE=`docker compose config --images ${SERVICE}` | |
docker tag $NEW_IMAGE ${REPO}:latest | |
docker tag $NEW_IMAGE ${REPO}:${ISIS_VERSION}-${ASP_VERSION} | |
# NEW_IMAGE=`docker compose config --images ${{ env.SERVICE }}` | |
# docker tag $NEW_IMAGE ${{ env.REPO }}:latest | |
# docker tag $NEW_IMAGE ${{ env.REPO }}:${ISIS_VERSION}-${ASP_VERSION} | |
# DATE=`date +%Y%m%d` | |
# docker tag $NEW_IMAGE ${{ env.REPO }}:$DATE | |
# - name: Tag image with SHA hash | |
# if: ${{ github.event_name == 'push' }} | |
# run: | | |
# IMAGE_SHA=`docker images -q $NEW_IMAGE` | |
# docker tag $NEW_IMAGE ${USERNAME}/jupyter-gispy:$IMAGE_SHA | |
- # https://github.com/marketplace/actions/docker-login | |
name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Push image | |
run: > | |
docker image ls | |
| tail -n+2 | awk '{print $1":"$2}' | |
| grep "${REPO}" | |
| xargs -I'{}' docker push {} | |
# docker image ls | |
# | tail -n+2 | awk '{print $1":"$2}' | |
# | grep "${{ env.REPO }}" | |
# | xargs -I'{}' docker push {} |