check context #10
Workflow file for this run
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 Role Test | |
| on: | |
| push: | |
| branches: | |
| - dev-actions | |
| permissions: | |
| id-token: write | |
| contents: read | |
| jobs: | |
| build-and-push: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Repo | |
| uses: actions/checkout@v4 | |
| - name: AWS config | |
| uses: aws-actions/configure-aws-credentials@v3 | |
| with: | |
| role-to-assume: ${{ secrets.AWS_DEV_ROLE }} | |
| role-session-name: GithubNGAGeointSession | |
| aws-region: ${{ secrets.AWS_DEV_REGION }} | |
| - name: AWS ECR Login | |
| id: ecr-login | |
| uses: aws-actions/amazon-ecr-login@v2 | |
| - name: Set IMAGE_TAG | |
| run: | | |
| if [[ "${{ github.ref_name }}" == "test" ]]; then | |
| echo "IMAGE_TAG=test" >> $GITHUB_ENV | |
| else | |
| echo "IMAGE_TAG=dev" >> $GITHUB_ENV | |
| fi | |
| - name: Check Context | |
| run: ls -la | |
| - name: Build Docker image and push | |
| env: | |
| REGISTRY: ${{ steps.ecr-login.outputs.registry }} | |
| REPOSITORY: "/mage/server" | |
| IMAGE_TAG: ${{ env.IMAGE_TAG }} | |
| run: | |
| echo "TAG IS $REGISTRY$REPOSITORY:$IMAGE_TAG" | |
| ls | |
| docker build -t $REGISTRY$REPOSITORY:$IMAGE_TAG . | |
| docker push $REGISTRY$REPOSITORY:$IMAGE_TAG | |
| - name: TEST ECS Access | |
| run: aws ecs list-clusters |