add id-token permission for OIDC #62
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Frontend Deploy to Dev | |
on: | |
push: | |
branches: | |
- develop | |
- feat/alpha-env | |
paths: | |
- frontend/** | |
- .github/** | |
permissions: | |
id-token: write | |
jobs: | |
build-dockerfile: | |
defaults: | |
run: | |
working-directory: frontend | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '18.x' | |
- name: Cache Yarn global cache | |
uses: actions/cache@v3 | |
with: | |
path: '**/.yarn' | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- name: Cache Yarn project cache | |
uses: actions/cache@v3 | |
with: | |
path: '**/.yarn/cache' | |
key: ${{ runner.os }}-yarn-project-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn-project- | |
- name: Install dependencies | |
run: yarn install --immutable | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Log in to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build and push | |
uses: docker/build-push-action@v4 | |
with: | |
context: ./frontend | |
file: ./frontend/Dockerfile.dev | |
push: true | |
tags: ${{ secrets.FRONTEND_ALPHA_IMAGE_NAME }}:latest | |
platforms: | | |
linux/amd64 | |
linux/arm64 | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
role-to-assume: arn:aws:iam::791335373803:role/SendCommandToEc2FromGithub | |
aws-region: ${{ secrets.AWS_REGION }} | |
- name: CD on EC2 | |
uses: zip-go/[email protected] | |
with: | |
instanceName: ${{ secrets.ALPHA_INSTANCE_NAME }} | |
workingDirectory: ${{ secrets.ALPHA_WORKING_DIRECTORY }} | |
commands: | | |
docker compose restart zipgo-frontend | |
echo "Succeeded: $GITHUB_SHA" > result.txt |