fix totalCollectedToday #62
This file contains hidden or 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: AWS-Build-Push-Dev | |
| on: | |
| push: | |
| branches: | |
| - dev | |
| workflow_dispatch: | |
| env: | |
| REPOSITORY: 'sdk-example' | |
| ECS_Cluster: "topia-dev-sdk-apps" | |
| reponame: "${{ github.event.repository.name }}" | |
| ENV: "dev" | |
| concurrency: | |
| group: ${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| id-token: write # This is required for requesting the JWT | |
| contents: read # This is required for actions/checkout | |
| jobs: | |
| Build: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| service: ${{ steps.sername.outputs.service }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: get servicename | |
| id: sername | |
| run: | | |
| service_value=$(jq -c ".\"$reponame\"" <<< '${{ vars.repo_service_map }}') | |
| echo "$(echo $service_value | jq -c)" | |
| if [[ $service_value == null ]]; then | |
| echo "Service value from map is missing. Using repository name instead." | |
| echo "service=[\""$reponame"\"]" >> "$GITHUB_OUTPUT" | |
| elif [[ -n "$service_value" && $(echo "$service_value" | jq 'length == 0') == "true" ]]; then | |
| echo "The app has no service deployed" | |
| echo "service=[]" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "service=$service_value" >> "$GITHUB_OUTPUT" | |
| echo "Service value: $(echo $service_value | jq -c )" | |
| fi | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20.10 | |
| cache: 'npm' | |
| - run: npm i | |
| - run: CI=false npm run build | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Configure AWS credentials | |
| uses: aws-actions/configure-aws-credentials@v4 | |
| with: | |
| role-to-assume: arn:aws:iam::368076259134:role/github-actions-role | |
| aws-region: us-east-1 | |
| - name: Login to Amazon ECR | |
| id: login-ecr | |
| uses: aws-actions/amazon-ecr-login@v2 | |
| - name: Image Metadata | |
| id: metadata | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ steps.login-ecr.outputs.registry }}/${{ env.REPOSITORY }} | |
| tags: | | |
| type=raw,value=${{ github.event.repository.name }} | |
| - name: Build and tag | |
| run: | | |
| docker build --build-arg COMMIT_HASH=${{ github.sha }} --build-arg REF=${{ github.ref }} -t ${{ steps.metadata.outputs.tags }} . | |
| - name: push docker image to Amazon ECR | |
| run: | | |
| docker push ${{ steps.metadata.outputs.tags }} | |
| deploy_matrix: | |
| runs-on: ubuntu-latest | |
| needs: Build | |
| strategy: | |
| matrix: | |
| service: ${{ fromJson(needs.Build.outputs.service) }} | |
| steps: | |
| - name: Configure AWS credentials | |
| uses: aws-actions/configure-aws-credentials@v4 | |
| with: | |
| role-to-assume: arn:aws:iam::368076259134:role/github-actions-role | |
| aws-region: us-east-1 | |
| - name: deploy | |
| run: | | |
| aws ecs update-service --cluster ${{ env.ECS_Cluster }} --service topia-${{ env.ENV }}-${{ matrix.service }}0 --force-new-deployment | |