Skip to content

Commit

Permalink
add automation to build and push images
Browse files Browse the repository at this point in the history
  • Loading branch information
johrstrom committed Feb 4, 2021
1 parent cc92426 commit d70ee12
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/publish_image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Publish Docker image

on:
push:
tags: '*'

defaults:
run:
shell: bash

jobs:
push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
- name: setup the environment
run: |
TAG=${GITHUB_REF#refs/heads/}
REPO="docker.io/ohiosupercomputer"
echo "LATEST_IMG=$REPO/ood-doc-build:latest" >> $GITHUB_ENV
echo "VERSIONED_IMG=$REPO/ood-doc-build:$TAG" >> $GITHUB_ENV
- name: docker build and tag
run: |
docker build -t $LATEST_IMG .
docker tag $LATEST_IMG $VERSIONED_IMG
- name: login to dockerhub
run: docker login -u oscrobot -p ${{ secrets.OSC_ROBOT_DOCKERHUB_TOKEN }}
- name: push images to dockerhub
run: |
docker push $LATEST_IMG
docker push $VERSIONED_IMG

0 comments on commit d70ee12

Please sign in to comment.