Skip to content

Manual Env Deploy

Manual Env Deploy #355

Workflow file for this run

name: Manual Env Deploy
on:
workflow_dispatch:
inputs:
destination_branch:
type: choice
description: 'Destination environment'
required: true
default: 'stage'
options: ['stage', 'main']
jobs:
stage-merge:
runs-on: ubuntu-latest
steps:
- name: Check if user is allowed to execute the workflow
run: |
if [[ "${{ github.event_name }}" == 'workflow_dispatch' && ("${{ github.actor }}" != 'coretex-admin' && "${{ github.actor }}" != 'igorperic17' && "${{ github.repository_owner }}" != "${{ github.actor }}" ) ]]; then
echo "::error::You are not authorized to execute this workflow."
exit 1
fi
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Merge develop into destination branch
run: |
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor }}@users.noreply.github.com"
git fetch
git checkout stage
git pull
git pull --rebase origin develop
git push --force
prod-merge:
needs: stage-merge
runs-on: ubuntu-latest
if: ${{ github.event.inputs.destination_branch == 'main' }}
steps:
- name: Check if user is allowed to execute the workflow
run: |
allowed_users=("igorperic17" "coretex-admin")
if [[ "${{ github.event_name }}" == 'workflow_dispatch' && ! ("${{ github.repository_owner }}" == "${{ github.actor }}" || "${allowed_users[*]}" =~ "${{ github.actor }}" ) ]]; then
echo "::error::You are not authorized to execute this workflow."
exit 1
fi
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Merge develop into destination branch
run: |
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor }}@users.noreply.github.com"
git fetch
git checkout main
git pull
git pull --rebase origin stage
git push --force