Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support dev/stg auto deploy #368

Merged
merged 1 commit into from
Jan 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 23 additions & 9 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
name: Deploy
on:
push:
branches: [main]
branches:
- main
- dev
workflow_dispatch:
inputs:
build:
Expand Down Expand Up @@ -36,13 +38,25 @@ jobs:
contents: read

steps:
- name: Check branch
- name: Manipulate Environment
id: manipulate
run: |
if [ "${{ env.DATA_ENV }}" = "prod" ]; then
if [ "$GITHUB_REF_NAME" != "main" ]; then
echo "Operation not permitted"
exit 1
fi
if [ "${{ github.event_name }}" = "push" ] && [ "$GITHUB_REF_NAME" = "main" ]; then
echo "env=prod" >> $GITHUB_OUTPUT
elif [ "${{ github.event_name }}" = "push" ] && [ "$GITHUB_REF_NAME" = "dev" ]; then
echo "env=stg" >> $GITHUB_OUTPUT
elif [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "env=${{ env.DATA_ENV }}" >> $GITHUB_OUTPUT
else
echo "Operation not permitted"
exit 1
fi

- name: Check production branch
run: |
if [ "${{ steps.manipulate.outputs.env }}" = "prod" ] && [ "$GITHUB_REF_NAME" != "main" ]; then
echo "Operation not permitted"
exit 1
fi

- name: Checkout
Expand All @@ -59,8 +73,8 @@ jobs:

- name: Build and Push images to ECR
run: |
.github/scripts/build.sh ${{ env.DATA }} ${{ env.DATA_ENV }}
.github/scripts/build.sh ${{ env.DATA }} ${{ steps.manipulate.outputs.env }}

- name: Create Deployment
run: |
.github/scripts/deploy.sh ${{ env.DATA_ENV }}
.github/scripts/deploy.sh ${{ steps.manipulate.outputs.env }}
Loading