Skip to content
Merged
Show file tree
Hide file tree
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
72 changes: 72 additions & 0 deletions .github/workflows/_deploy-native.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: deploy-native-template

on:
workflow_call:
inputs:
target_branch:
required: false
type: string
default: ''
ecr_repository:
required: true
type: string
dockerfile:
required: true
type: string
description: 'Dockerfile path (e.g., api/Dockerfile-native)'
secrets:
AWS_ACCESS_KEY_ID:
required: true
AWS_SECRET_ACCESS_KEY:
required: true

jobs:
deploy:
name: Deploy Native
runs-on: ubuntu-24.04-arm

env:
IMAGE_TAG: ${{ github.run_number }}
BUILD_NUMBER: ${{ github.run_number }}
ECR_REGISTRY: 405906814034.dkr.ecr.ap-northeast-2.amazonaws.com
ECR_REPOSITORY: ${{ inputs.ecr_repository }}

steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ inputs.target_branch || github.ref }}

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ap-northeast-2

- name: Login to ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2

- name: Get and save Auth Token for CodeArtifact
id: get-save-codeartifact-auth-token
run: |
aws codeartifact get-authorization-token \
--domain wafflestudio \
--domain-owner 405906814034 \
--query authorizationToken \
--region ap-northeast-1 \
--output text > .codeartifact_token

- name: Docker build, tag, and push image to ECR
id: build-push-image
run: |
docker build \
--secret id=codeartifact_token,src=./.codeartifact_token \
-f ${{ inputs.dockerfile }} \
-t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG \
. \
--platform linux/arm64
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
echo "image=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" >> $GITHUB_OUTPUT

71 changes: 71 additions & 0 deletions .github/workflows/_deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: deploy-template

on:
workflow_call:
inputs:
target_branch:
required: false
type: string
default: ''
ecr_repository:
required: true
type: string
dockerfile:
required: true
type: string
description: 'Dockerfile path (e.g., api/Dockerfile)'
secrets:
AWS_ACCESS_KEY_ID:
required: true
AWS_SECRET_ACCESS_KEY:
required: true

jobs:
deploy:
name: Deploy
runs-on: ubuntu-24.04-arm

env:
IMAGE_TAG: ${{ github.run_number }}
BUILD_NUMBER: ${{ github.run_number }}
ECR_REGISTRY: 405906814034.dkr.ecr.ap-northeast-2.amazonaws.com
ECR_REPOSITORY: ${{ inputs.ecr_repository }}

steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ inputs.target_branch || github.ref }}

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ap-northeast-2

- name: Login to ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2

- name: Get and save Auth Token for CodeArtifact
id: get-save-codeartifact-auth-token
run: |
aws codeartifact get-authorization-token \
--domain wafflestudio \
--domain-owner 405906814034 \
--query authorizationToken \
--region ap-northeast-1 \
--output text > .codeartifact_token

- name: Docker build, tag, and push image to ECR
id: build-push-image
run: |
docker build \
--secret id=codeartifact_token,src=./.codeartifact_token \
-f ${{ inputs.dockerfile }} \
-t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG \
. \
--platform linux/arm64
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
echo "image=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" >> $GITHUB_OUTPUT
41 changes: 7 additions & 34 deletions .github/workflows/deploy-api-dev-native.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,37 +6,10 @@ on:

jobs:
deploy:
name: Deploy-api-dev-native
runs-on: ubuntu-24.04-arm
env:
IMAGE_TAG: ${{ github.run_number }}
BUILD_NUMBER: ${{ github.run_number }}
ECR_REGISTRY: 405906814034.dkr.ecr.ap-northeast-2.amazonaws.com
ECR_REPOSITORY: snutt-dev/snutt-timetable

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ap-northeast-2

- name: Login to ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2

- name: Get and save Auth Token for CodeArtifact
id: get-save-codeartifact-auth-token
run: |
aws codeartifact get-authorization-token --domain wafflestudio --domain-owner 405906814034 --query authorizationToken --region ap-northeast-1 --output text > .codeartifact_token

- name: Docker build, tag, and push image to ECR
id: build-push-image
run: |
docker build --secret id=codeartifact_token,src=./.codeartifact_token -f api/Dockerfile-native -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG . --platform linux/arm64
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG"
uses: ./.github/workflows/_deploy-native.yml
with:
ecr_repository: snutt-dev/snutt-timetable
dockerfile: api/Dockerfile-native
secrets:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
41 changes: 7 additions & 34 deletions .github/workflows/deploy-api-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,37 +6,10 @@ on:

jobs:
deploy:
name: Deploy-api-dev
runs-on: ubuntu-24.04-arm
env:
IMAGE_TAG: ${{ github.run_number }}
BUILD_NUMBER: ${{ github.run_number }}
ECR_REGISTRY: 405906814034.dkr.ecr.ap-northeast-2.amazonaws.com
ECR_REPOSITORY: snutt-dev/snutt-timetable

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ap-northeast-2

- name: Login to ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2

- name: Get and save Auth Token for CodeArtifact
id: get-save-codeartifact-auth-token
run: |
aws codeartifact get-authorization-token --domain wafflestudio --domain-owner 405906814034 --query authorizationToken --region ap-northeast-1 --output text > .codeartifact_token

- name: Docker build, tag, and push image to ECR
id: build-push-image
run: |
docker build --secret id=codeartifact_token,src=./.codeartifact_token -f api/Dockerfile -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG . --platform linux/arm64
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG"
uses: ./.github/workflows/_deploy.yml
with:
ecr_repository: snutt-dev/snutt-timetable
dockerfile: api/Dockerfile
secrets:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
51 changes: 19 additions & 32 deletions .github/workflows/deploy-api-prod-native.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,37 +6,24 @@ on:

jobs:
deploy:
name: Deploy-api-prod-native
runs-on: ubuntu-24.04-arm
env:
IMAGE_TAG: ${{ github.run_number }}
BUILD_NUMBER: ${{ github.run_number }}
ECR_REGISTRY: 405906814034.dkr.ecr.ap-northeast-2.amazonaws.com
ECR_REPOSITORY: snutt-prod/snutt-timetable
uses: ./.github/workflows/_deploy-native.yml
with:
ecr_repository: snutt-prod/snutt-timetable
dockerfile: api/Dockerfile-native
secrets:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

notify:
needs: deploy
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ap-northeast-2

- name: Login to ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2

- name: Get and save Auth Token for CodeArtifact
id: get-save-codeartifact-auth-token
run: |
aws codeartifact get-authorization-token --domain wafflestudio --domain-owner 405906814034 --query authorizationToken --region ap-northeast-1 --output text > .codeartifact_token

- name: Docker build, tag, and push image to ECR
id: build-push-image
run: |
docker build --secret id=codeartifact_token,src=./.codeartifact_token -f api/Dockerfile-native -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG . --platform linux/arm64
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG"
- name: Slack Notify
uses: rtCamp/action-slack-notify@v2.3.3
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_CHANNEL: team-snutt-deploy
SLACK_TITLE: NEW RELEASE
SLACK_USERNAME: snutt-timetable
SLACK_ICON: https://user-images.githubusercontent.com/35535636/103177470-2237cb00-48be-11eb-9211-3ffa567c8ac3.png
SLACK_MESSAGE: Check <https://argocd.wafflestudio.com|Argo CD> for updated environment
45 changes: 11 additions & 34 deletions .github/workflows/deploy-api-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,41 +6,18 @@ on:

jobs:
deploy:
name: Deploy-api-prod
runs-on: ubuntu-24.04-arm
env:
IMAGE_TAG: ${{ github.run_number }}
BUILD_NUMBER: ${{ github.run_number }}
ECR_REGISTRY: 405906814034.dkr.ecr.ap-northeast-2.amazonaws.com
ECR_REPOSITORY: snutt-prod/snutt-timetable

uses: ./.github/workflows/_deploy.yml
with:
ecr_repository: snutt-prod/snutt-timetable
dockerfile: api/Dockerfile
secrets:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

notify:
needs: deploy
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ap-northeast-2

- name: Login to ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2

- name: Get and save Auth Token for CodeArtifact
id: get-save-codeartifact-auth-token
run: |
aws codeartifact get-authorization-token --domain wafflestudio --domain-owner 405906814034 --query authorizationToken --region ap-northeast-1 --output text > .codeartifact_token

- name: Docker build, tag, and push image to ECR
id: build-push-image
run: |
docker build --secret id=codeartifact_token,src=./.codeartifact_token -f api/Dockerfile -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG . --platform linux/arm64
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG"

- name: Slack Notify
uses: rtCamp/action-slack-notify@v2.3.3
env:
Expand Down
41 changes: 7 additions & 34 deletions .github/workflows/deploy-batch-dev-native.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,37 +6,10 @@ on:

jobs:
deploy:
name: Deploy-batch-dev-native
runs-on: ubuntu-24.04-arm
env:
IMAGE_TAG: ${{ github.run_number }}
BUILD_NUMBER: ${{ github.run_number }}
ECR_REGISTRY: 405906814034.dkr.ecr.ap-northeast-2.amazonaws.com
ECR_BATCH_REPOSITORY: snutt-dev/snutt-timetable-batch

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ap-northeast-2

- name: Login to ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2

- name: Get and save Auth Token for CodeArtifact
id: get-save-codeartifact-auth-token
run: |
aws codeartifact get-authorization-token --domain wafflestudio --domain-owner 405906814034 --query authorizationToken --region ap-northeast-1 --output text > .codeartifact_token

- name: Docker build, tag, and push image to ECR
id: build-push-image
run: |
docker build --secret id=codeartifact_token,src=./.codeartifact_token -f batch/Dockerfile-native -t $ECR_REGISTRY/$ECR_BATCH_REPOSITORY:$IMAGE_TAG . --platform linux/arm64
docker push $ECR_REGISTRY/$ECR_BATCH_REPOSITORY:$IMAGE_TAG
echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG"
uses: ./.github/workflows/_deploy-native.yml
with:
ecr_repository: snutt-dev/snutt-timetable-batch
dockerfile: batch/Dockerfile-native
secrets:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
Loading