feat: add workflow for promoting master to production with testing and deployment steps
Some checks failed
Chore App Build, Test, and Push Docker Images / build-and-push (push) Has been cancelled
Some checks failed
Chore App Build, Test, and Push Docker Images / build-and-push (push) Has been cancelled
This commit is contained in:
@@ -31,7 +31,7 @@ on:
|
||||
require_manual_approval:
|
||||
description: "Require approval token for deploy job"
|
||||
required: true
|
||||
default: "true"
|
||||
default: "false"
|
||||
approval_token:
|
||||
description: "Approval token value when manual approval is required"
|
||||
required: false
|
||||
@@ -192,13 +192,27 @@ jobs:
|
||||
script: |
|
||||
set -euo pipefail
|
||||
|
||||
cd /opt
|
||||
if [ -d "chore/.git" ]; then
|
||||
cd chore
|
||||
repo_dir="${{ secrets.DEPLOY_PROD_PATH }}"
|
||||
if [ -z "$repo_dir" ]; then
|
||||
repo_dir="$HOME/chore"
|
||||
fi
|
||||
|
||||
repo_parent=$(dirname "$repo_dir")
|
||||
if [ ! -d "$repo_parent" ]; then
|
||||
mkdir -p "$repo_parent"
|
||||
fi
|
||||
if [ ! -w "$repo_parent" ]; then
|
||||
echo "Deploy user $(whoami) cannot write to ${repo_parent}."
|
||||
echo "Set DEPLOY_PROD_PATH to a writable location or grant write access before rerunning promotion."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -d "$repo_dir/.git" ]; then
|
||||
cd "$repo_dir"
|
||||
git fetch --all --tags
|
||||
else
|
||||
git clone --branch "${{ needs.prepare.outputs.target_ref }}" https://git.ryankegel.com/ryan/chore.git chore
|
||||
cd chore
|
||||
git clone --branch "${{ needs.prepare.outputs.target_ref }}" https://git.ryankegel.com/ryan/chore.git "$repo_dir"
|
||||
cd "$repo_dir"
|
||||
fi
|
||||
|
||||
git checkout "${{ needs.prepare.outputs.target_ref }}"
|
||||
|
||||
Reference in New Issue
Block a user