Skip to content

converted notes over to RA. #147

converted notes over to RA.

converted notes over to RA. #147

Workflow file for this run

# ----------------------------------------------------------------------------------------------------------------------
# Build and Deploy docker images
#
# This action requires the following variables and secrets to be set:
# * vars.PORTAINER_HOST - The deployment username for PORTAINER_HOST
# * secrets.PORTAINER_USERNAME - The deployment username for PORTAINER_HOST
# * secrets.PORTAINER_PASSWORD - The deployment password for PORTAINER_USERNAME
# * secrets.GOOGLE_CLIENT_ID - The Google OAuth 2.0 Client ID
# * secrets.GOOGLE_CLIENT_SECRET - The Google OAuth 2.0 Client Secret
# * secrets.BETA_SESSION_SECRET - The beta site's session secret
# * secrets.PROD_SESSION_SECRET - The prod site's session secret
# ----------------------------------------------------------------------------------------------------------------------
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@v4
- 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 tagged version
if: success() && env.VERSION != 'latest'
uses: actions-hub/docker@master
with:
args: push morgul/rpgkeeper:${VERSION}
- name: Push latest
if: success()
uses: actions-hub/docker@master
with:
args: push morgul/rpgkeeper:latest
# Deploys Beta docker
deploy-beta:
needs: push
runs-on: ubuntu-latest
if: github.event_name == 'push'
steps:
- uses: actions/checkout@v4
- 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: nvti/portainer-stack-deploy@v1.4
with:
portainer-host: ${{ vars.PORTAINER_HOST }}
endpoint-id: 2
username: ${{ secrets.PORTAINER_USERNAME }}
password: ${{ secrets.PORTAINER_PASSWORD }}
stack-name: 'rpgkeeper-beta'
stack-definition: 'compose/beta.yml'
template-variables: '{"client": "${{ secrets.GOOGLE_CLIENT_ID }}", "secret": "${{ secrets.GOOGLE_CLIENT_SECRET }}", "sess": "${{ secrets.BETA_SESSION_SECRET }}"}'
prune-stack: false
pull-image: true
# - 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@v4
- 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: nvti/portainer-stack-deploy@v1.4
with:
portainer-host: ${{ vars.PORTAINER_HOST }}
endpoint-id: 2
username: ${{ secrets.PORTAINER_USERNAME }}
password: ${{ secrets.PORTAINER_PASSWORD }}
stack-name: 'rpgkeeper'
stack-definition: 'compose/prod.yml'
template-variables: '{"version": "${{ env.VERSION }}", "client": "${{ secrets.GOOGLE_CLIENT_ID }}", "secret": "${{ secrets.GOOGLE_CLIENT_SECRET }}", "sess": "${{ secrets.PROD_SESSION_SECRET }}"}'
prune-stack: false
pull-image: true
# - 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 }}