diff --git a/.github/workflows/auto-assign.yml b/.github/workflows/auto-assign.yml index 663f881..08b89ea 100644 --- a/.github/workflows/auto-assign.yml +++ b/.github/workflows/auto-assign.yml @@ -20,7 +20,7 @@ jobs: steps: - name: Choose an Assignee run: echo ASSIGNEE=$(shuf -e HaradaTakayuki kazutan1230 Marukome0743 tanePON -n 1) >> $GITHUB_ENV - + - name: Assign Issue if: github.event_name == 'issues' && toJSON(github.event.issue.assignees) == '[]' run: gh issue edit ${{ github.event.issue.number }} --add-assignee ${{ env.ASSIGNEE }} --repo ${{ github.repository }} diff --git a/.github/workflows/push-image.yml b/.github/workflows/push-image.yml index 53bc67a..d5f2b6e 100644 --- a/.github/workflows/push-image.yml +++ b/.github/workflows/push-image.yml @@ -68,19 +68,6 @@ jobs: username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Configure AWS credentials - if: fromJSON(env.IS_PUSH) - uses: aws-actions/configure-aws-credentials@v4 - with: - aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} - aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - aws-region: ${{ env.AWS_REGION }} - - - name: Login to Amazon ECR - if: fromJSON(env.IS_PUSH) - id: login-ecr - uses: aws-actions/amazon-ecr-login@v2 - - name: Docker Meta id: meta uses: docker/metadata-action@v5 @@ -109,17 +96,6 @@ jobs: cache-to: type=gha,mode=max provenance: false - - name: Build and Push Image to Amazon ECR - if: fromJSON(env.IS_PUSH) - env: - ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} - IMAGE_TAG: ${{ github.sha }} - run: | - docker build --platform linux/arm64 -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG . - docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG - aws lambda update-function-code --function-name $LAMBDA_FUNCTION_NAME \ - --architectures arm64 --image-uri $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG - - name: Docker Scout if: github.repository_owner == env.REPOSITORY_OWNER && github.event_name == 'pull_request_target' uses: docker/scout-action@v1 @@ -128,3 +104,38 @@ jobs: image: ${{ env.REPOSITORY }}:${{ steps.meta.outputs.version }} to: ${{ env.GHCR_REGISTRY }}/${{ env.GHCR_REPOSITORY }}:canary only-severities: critical,high + + lambda: + runs-on: ubuntu-latest + if: inputs.push || github.event_name == 'push' && github.repository_owner == 'openup-labtakizawa' && github.ref_name == 'main' + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v4 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: ${{ env.AWS_REGION }} + + - name: Login to Amazon ECR + id: login-ecr + uses: aws-actions/amazon-ecr-login@v2 + + - name: Build and Push Image to Amazon ECR + env: + ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} + IMAGE_TAG: ${{ github.sha }} + run: | + docker build --platform linux/arm64 -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG . + docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG + aws lambda update-function-code --function-name $LAMBDA_FUNCTION_NAME \ + --architectures arm64 --image-uri $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG