Skip to content

Commit

Permalink
Merge pull request #7 from jsfillman/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
jsfillman authored Feb 23, 2022
2 parents 2bdb988 + fb1be29 commit 9a9313e
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 41 deletions.
Original file line number Diff line number Diff line change
@@ -1,26 +1,24 @@
---
name: Tag Latest Test Image
name: Publish RC Image
'on':
pull_request:
release:
branches:
- develop
types:
- closed
- published
jobs:
docker_tag:
docker_build:
runs-on: ubuntu-latest
steps:
- name: Check out GitHub Repo
if: github.event_name == 'pull_request' && github.event.action == 'closed' &&
github.event.pull_request.merged == true
with:
ref: "${{ github.event.pull_request.head.sha }}"
uses: actions/checkout@v2
- name: Build and Push to Packages
if: github.event.pull_request.draft == false
env:
PR: "${{ github.event.pull_request.number }}"
SHA: "${{ github.event.pull_request.head.sha }}"
VER: "${{ github.event.release.tag_name }}"
DOCKER_ACTOR: "${{ secrets.GHCR_USERNAME }}"
DOCKER_TOKEN: "${{ secrets.GHCR_TOKEN }}"
run: "./.github/workflows/scripts/tag_test_latest.sh\n"
run: "./.github/workflows/scripts/develop_rc_release.sh\n"
Original file line number Diff line number Diff line change
@@ -1,27 +1,24 @@
---
name: Tag Prod Latest
name: Publish Release Image
'on':
pull_request:
release:
branches:
- master
- main
types:
- closed
- published
jobs:
docker_tag:
docker_build:
runs-on: ubuntu-latest
steps:
- name: Check out GitHub Repo
if: github.event_name == 'pull_request' && github.event.action == 'closed' &&
github.event.pull_request.merged == true
with:
ref: "${{ github.event.pull_request.head.sha }}"
uses: actions/checkout@v2
- name: Build and Push to Packages
if: github.event.pull_request.draft == false
env:
PR: "${{ github.event.pull_request.number }}"
SHA: "${{ github.event.pull_request.head.sha }}"
VER: "${{ github.event.release.tag_name }}"
DOCKER_ACTOR: "${{ secrets.GHCR_USERNAME }}"
DOCKER_TOKEN: "${{ secrets.GHCR_TOKEN }}"
run: "./.github/workflows/scripts/tag_prod_latest.sh\n"
run: "./.github/workflows/scripts/prod_release.sh\n"
19 changes: 19 additions & 0 deletions .github/workflows/scripts/develop_rc_release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#! /usr/bin/env bash

export MY_ORG=$(echo "${GITHUB_REPOSITORY}" | awk -F / '{print $1}')
export MY_APP=$(echo $(echo "${GITHUB_REPOSITORY}" | awk -F / '{print $2}')"-develop")
export DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
export BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
export COMMIT=$(echo "$SHA" | cut -c -7)

echo $DOCKER_TOKEN | docker login ghcr.io -u $DOCKER_ACTOR --password-stdin
docker build --build-arg BUILD_DATE="$DATE" \
--build-arg COMMIT="$COMMIT" \
--build-arg BRANCH="$GITHUB_HEAD_REF" \
--build-arg PULL_REQUEST="$PR" \
--build-arg VERSION="$VER" \
--label us.kbase.vcs-pull-req="$PR" \
-t ghcr.io/"$MY_ORG"/"$MY_APP":"$VER""-rc" \
-t ghcr.io/"$MY_ORG"/"$MY_APP":"latest" .
docker push ghcr.io/"$MY_ORG"/"$MY_APP":"$VER""-rc"
docker push ghcr.io/"$MY_ORG"/"$MY_APP":"latest"
19 changes: 19 additions & 0 deletions .github/workflows/scripts/prod_release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#! /usr/bin/env bash

export MY_ORG=$(echo "${GITHUB_REPOSITORY}" | awk -F / '{print $1}')
export MY_APP=$(echo "${GITHUB_REPOSITORY}" | awk -F / '{print $2}')
export DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
export BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
export COMMIT=$(echo "$SHA" | cut -c -7)

echo $DOCKER_TOKEN | docker login ghcr.io -u $DOCKER_ACTOR --password-stdin
docker build --build-arg BUILD_DATE="$DATE" \
--build-arg COMMIT="$COMMIT" \
--build-arg BRANCH="$GITHUB_HEAD_REF" \
--build-arg PULL_REQUEST="$PR" \
--build-arg VERSION="$VER" \
--label us.kbase.vcs-pull-req="$PR" \
-t ghcr.io/"$MY_ORG"/"$MY_APP":"$VER" \
-t ghcr.io/"$MY_ORG"/"$MY_APP":"latest" .
docker push ghcr.io/"$MY_ORG"/"$MY_APP":"$VER"
docker push ghcr.io/"$MY_ORG"/"$MY_APP":"latest"
12 changes: 0 additions & 12 deletions .github/workflows/scripts/tag_prod_latest.sh

This file was deleted.

12 changes: 0 additions & 12 deletions .github/workflows/scripts/tag_test_latest.sh

This file was deleted.

0 comments on commit 9a9313e

Please sign in to comment.