fix(git-actions) add permissions on ci #4
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: 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: Login to Docker Hub | |
# uses: docker/login-action@v3 | |
# with: | |
# username: ${{secrets.DOCKERHUB_USERNAME}} | |
# password: ${{secrets.DOCKERHUB_TOKEN}} | |
# - name: Build Docker Image | |
# run: docker build -t wiredworldweb/wired:${{steps.generate_tag.outputs.sha}} . | |
# - name: Push image | |
# run: docker push | |
# - name: Build and push | |
# uses: docker/build-push-action@v6 | |
# with: | |
# push: true | |
# tags: wiredworldweb/wired:${{steps.generate_tag.outputs.sha}},wiredworldweb/wired:latest | |
- name: Configure AWS Credentials for China region audience | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
# audience: sts.amazonaws.com.cn | |
aws-region: us-east-2 | |
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 |