Skip to content

Updating when we build docker versions. #92

Updating when we build docker versions.

Updating when we build docker versions. #92

Workflow file for this run

# ----------------------------------------------------------------------------------------------------------------------
# Build and Deploy docker images
#
# This action requires the following secrets to be set:
# * RANCHER_ACCESS_KEY - API Access key created in Rancher.
# * RANCHER_SECRET_KEY - API Secret key created in Rancher.
# ----------------------------------------------------------------------------------------------------------------------
name: Docker
on:
push:
branches:
- master
tags:
- v*
release:
types: [published, prereleased, released]
env:
IMAGE_NAME: rpgkeeper
jobs:
push:
runs-on: ubuntu-latest
if: github.event_name == 'push'
steps:
- uses: actions/checkout@v3
- name: Login to docker hub
if: success()
uses: actions-hub/docker/login@master
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
- name: Set ENV Variables.
run: |
# Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# Strip "v" prefix from tag name
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
# Use Docker `latest` tag convention
[ "$VERSION" == "master" ] && VERSION=latest
echo VERSION=$VERSION >> $GITHUB_ENV
- name: Build docker
if: success()
run: docker build -t morgul/rpgkeeper:${VERSION} .
- name: Push docker
if: success()
uses: actions-hub/docker@master
with:
args: push morgul/rpgkeeper:${VERSION}
# Deploys Beta docker
deploy-beta:
needs: push
runs-on: ubuntu-latest
if: github.event_name == 'push'
steps:
- uses: actions/checkout@v3
- name: Set ENV Variables.
run: |
# Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# Strip "v" prefix from tag name
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
# Use Docker `latest` tag convention
[ "$VERSION" == "master" ] && VERSION=latest
echo VERSION=$VERSION >> $GITHUB_ENV
- name: Deploy Beta Site
uses: SkewedAspect/rancher-redeploy@v0.5.0
env:
RANCHER_BEARER_TOKEN: ${{ secrets.RANCHER_API_KEY }}
RANCHER_CLUSTER_ID: 'c-g65ld'
RANCHER_NAMESPACE: 'rpgkeeper'
RANCHER_PROJECT_ID: 'p-7wdzf'
RANCHER_URL: 'https://rancher.skewedaspect.com/'
RANCHER_WORKLOAD: 'rpgkeeper-beta'
IMAGE_TAG: ${{ env.VERSION }}
# Deploys prod docker
deploy-prod:
needs: push
runs-on: ubuntu-latest
if: github.event_name == 'release'
steps:
- uses: actions/checkout@v3
- name: Set ENV Variables.
run: |
# Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# Strip "v" prefix from tag name
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
# Use Docker `latest` tag convention
[ "$VERSION" == "master" ] && VERSION=latest
echo VERSION=$VERSION >> $GITHUB_ENV
- name: Deploy Production Site
uses: SkewedAspect/rancher-redeploy@v0.5.0
env:
RANCHER_BEARER_TOKEN: ${{ secrets.RANCHER_API_KEY }}
RANCHER_CLUSTER_ID: 'c-g65ld'
RANCHER_NAMESPACE: 'rpgkeeper'
RANCHER_PROJECT_ID: 'p-7wdzf'
RANCHER_URL: 'https://rancher.skewedaspect.com/'
RANCHER_WORKLOAD: 'rpgkeeper'
IMAGE_TAG: ${{ env.VERSION }}