Skip to content

로그인 세션을 OIDC로 통합 #29

로그인 세션을 OIDC로 통합

로그인 세션을 OIDC로 통합 #29

Workflow file for this run

name: Build and push image
on:
push:
branches:
- master
tags:
- '*'
pull_request:
branches:
- master
permissions:
contents: read
id-token: write
jobs:
build:
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.vars.outputs.image-tag }}
application: ${{ steps.vars.outputs.application }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: ${{ vars.ECR_PUSH_ROLE_ARN }}
aws-region: ap-northeast-2
- name: Set variables
id: vars
env:
EVENT_NAME: ${{ github.event_name }}
REF_TYPE: ${{ github.ref_type }}
REF_NAME: ${{ github.ref_name }}
GIT_SHA: ${{ github.sha }}
run: |
date="$(date -u +%Y%m%d)"
short_rev="$(git rev-parse --short "$GIT_SHA")"
if [[ "$EVENT_NAME" != "push" || "$REF_TYPE" != "tag" ]]; then
echo "image-tag=${date}-${short_rev}" >> $GITHUB_OUTPUT
echo "application=bacchus-snu/id/dev" >> $GITHUB_OUTPUT
else
echo "image-tag=${REF_NAME}" >> $GITHUB_OUTPUT
echo "application=bacchus-snu/id/prod" >> $GITHUB_OUTPUT
fi
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ vars.ECR_URL }}/${{ vars.IMAGE_NAME }}:${{ steps.vars.outputs.image-tag }}
cache-from: type=gha
cache-to: type=gha,mode=max
deploy:
needs: build
if: ${{ github.event_name != 'pull_request' }}
uses: bacchus-snu/cd-manifests/.github/workflows/deploy-application.yaml@main
with:
application: ${{ needs.build.outputs.application }}
image: '${{ vars.ECR_URL }}/${{ vars.IMAGE_NAME }}'
tag: ${{ needs.build.outputs.tag }}
secrets:
app-id: '${{ secrets.CD_GITHUB_APP_ID }}'
app-private-key: '${{ secrets.CD_GITHUB_APP_SECRET_KEY }}'