Skip to content

maybe try this?

maybe try this? #102

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: |
if [ "$VERSION" == "latest" ]
then
docker build -t morgul/rpgkeeper:latest .
else
docker build -t morgul/rpgkeeper:${VERSION} -t morgul/rpgkeeper:latest .
fi
- name: Push docker
if: success()
uses: actions-hub/docker@master
with:
args: push --all-tags morgul/rpgkeeper
# 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 }}