This repository has been archived by the owner on Jun 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: adds docker build + public workflow for tutorials image (#7)
chore: removes atmos docker image + Makefile fix: attempts to fix tags output chore: adds some debugging code fix: adds newline to address set-output on one line chore: cleans up logic + adds comments
- Loading branch information
Showing
4 changed files
with
54 additions
and
56 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: "docker" | ||
on: | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
release: | ||
types: | ||
# "released" excludes pre-releases | ||
# "published" is either a release or a pre-release | ||
- published | ||
jobs: | ||
build-and-push: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout source code at current commit | ||
uses: actions/checkout@v2 | ||
|
||
# Based off of Geodesic docker workflow: | ||
# https://github.com/cloudposse/geodesic/blob/master/.github/workflows/docker.yml | ||
- name: Prepare tags for Docker image | ||
id: prepare | ||
run: | | ||
echo ::set-output name=publish::${{ (github.event_name == 'release' && github.event.action == 'published') || (github.event.pull_request.head.repo.full_name == github.repository) }} | ||
if [[ $GITHUB_REF == refs/tags/* ]]; then | ||
VERSION=${GITHUB_REF#refs/tags/} | ||
fi | ||
# By default, we tag our image with the short sha on all PR pushes | ||
TAGS="${{ github.repository }}:sha-${GITHUB_SHA:0:7}" | ||
# If this is a tagged release, then we tag w/ the semver tag + latest | ||
if [[ -n $VERSION ]]; then | ||
TAGS="$TAGS,${{ github.repository }}:${VERSION},${{ github.repository }}:latest" | ||
fi | ||
printf "Tagging with %s\n" "${TAGS}" | ||
echo "::set-output name=tags::${TAGS}" | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
- name: Login to DockerHub | ||
if: steps.prepare.outputs.publish == 'true' | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_PASSWORD }} | ||
- name: "Build and push docker image to DockerHub" | ||
id: docker_build | ||
uses: docker/build-push-action@v2 | ||
with: | ||
push: ${{ steps.prepare.outputs.publish == 'true' }} | ||
tags: ${{ steps.prepare.outputs.tags }} | ||
file: ./Dockerfile |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.