Skip to content

update check attendance api #142

update check attendance api

update check attendance api #142

Workflow file for this run

name: Build API
on:
push:
branches: [main]
permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
jobs:
deploy:
name: build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: arn:aws:iam::071353287696:role/bitmoi-github-action
aws-region: ap-northeast-2
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Load secrets and save to envfile
run: |
aws secretsmanager get-secret-value --secret-id bitmoi --query SecretString --output text | jq -r 'to_entries|map("\(.key)=\(.value)")|.[]' > a.env
- name: Build, tag, and push docker image to Amazon ECR
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: bitmoi
IMAGE_TAG: ${{ github.sha }}
run: |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG -t $ECR_REGISTRY/$ECR_REPOSITORY:latest .
docker push -a $ECR_REGISTRY/$ECR_REPOSITORY
# - name: Restart autoscaling group
# run: |
# aws autoscaling start-instance-refresh --auto-scaling-group-name bitmoi-api --preferences '{"InstanceWarmup":60}'
- name: Restart server
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.EC2_HOST }}
username: ${{ secrets.EC2_USERNAME }}
key: ${{ secrets.EC2_PRIV }}
script: |
cd /home/${{ secrets.EC2_USERNAME }}
./stop.sh
./start.sh