Skip to content

feat(git-actions) tags #17

feat(git-actions) tags

feat(git-actions) tags #17

Workflow file for this run

name: CI
on:
push:
branches:
- master
permissions:
id-token: write
contents: read
jobs:
cache-and-install:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
name: Install pnpm
with:
version: 8
run_install: false
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 18
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- name: Generate tag
id: generate_tag
run: |
SHA=$(echo $GITHUB_SHA | head -c7)
echo "sha=$SHA" >> $GITHUB_OUTPUT
- name: Configure AWS Credentials for China region audience
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: us-east-1
role-to-assume: arn:aws:iam::163547640766:role/ecr_role
- name: Login to AWS ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
- name: Build Docker Image
id: build-docker-image
env:
REGISTRY: ${{ steps.login-ecr.outputs.registry }}
TAG: ${{ steps.generate_tag.outputs.sha }}
run: |
docker build -t $REGISTRY/wired-ci:$TAG .
docker push $REGISTRY/wired-ci:$TAG
docker tag $REGISTRY/wired-ci:$TAG $REGISTRY/wired-ci:latest
docker push $REGISTRY/wired-ci:latest
IMAGE=$(echo $REGISTRY/wired-ci:$TAG)
echo "image=$IMAGE" >> $GITHUB_OUTPUT
- name: Deploy to app runner
id: deploy-app-runner
uses: awslabs/amazon-app-runner-deploy@main
with:
service: wired
image: ${{steps.build-docker-image.outputs.image}}
access-role-arn: arn:aws:iam::163547640766:role/app-runner-role
region: us-east-1
cpu: 1
memory: 2
port: 3000 //confira qual porta é exposta no dockerfile
wait-for-service-stability-seconds: 180
- name: App Runner check
run: echo "App Runner Running..." ${{steps.deploy-app-runner.outputs.service-url}}