|
| 1 | +# This is a basic workflow to help you get started with Actions |
| 2 | +name: Build Geoprocess Image, Push to Prod |
| 3 | + |
| 4 | +# Controls when the action will run. Invokes the workflow on push events but only for the main branch |
| 5 | +on: |
| 6 | + push: |
| 7 | + branches: [cwbi-prod] |
| 8 | + paths: |
| 9 | + - .github/workflows/cwbi-prod-build-push-geoproc.yml |
| 10 | + - 'async_geoprocess/**' |
| 11 | + workflow_dispatch: |
| 12 | + |
| 13 | +env: |
| 14 | + AWS_REGION: aws-us-gov #Change to reflect your Region |
| 15 | + |
| 16 | +# Permission can be added at job level or workflow level |
| 17 | +permissions: |
| 18 | + id-token: write # This is required for requesting the JWT |
| 19 | + contents: read # This is required for actions/checkout |
| 20 | +jobs: |
| 21 | + Build-Push-GeoProc-to-Prod: |
| 22 | + runs-on: ubuntu-latest |
| 23 | + steps: |
| 24 | + - name: Git clone the repository |
| 25 | + uses: actions/checkout@v4 |
| 26 | + - name: Configure AWS Credentials |
| 27 | + uses: aws-actions/configure-aws-credentials@v4 |
| 28 | + with: |
| 29 | + aws-region: us-gov-west-1 |
| 30 | + role-to-assume: arn:aws-us-gov:iam::648157167324:role/github-actions-ecr-cumulus |
| 31 | + output-credentials: true |
| 32 | + # Hello from AWS: WhoAmI |
| 33 | + - name: Sts GetCallerIdentity |
| 34 | + run: | |
| 35 | + aws sts get-caller-identity |
| 36 | + - name: Login to Amazon ECR |
| 37 | + id: login-ecr |
| 38 | + uses: aws-actions/amazon-ecr-login@v2 |
| 39 | + with: |
| 40 | + mask-password: 'true' |
| 41 | + - name: Build Image; Push to ECR |
| 42 | + env: |
| 43 | + ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} |
| 44 | + ECR_REPOSITORY: cumulus-geoprocess |
| 45 | + IMAGE_TAG: latest |
| 46 | + run: | |
| 47 | + docker build --build-arg GEOPROC_PACKAGE=main:geoproc async_geoprocess \ |
| 48 | + --tag $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG \ |
| 49 | + --tag $ECR_REGISTRY/$ECR_REPOSITORY:prod |
| 50 | + docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG |
| 51 | + docker push $ECR_REGISTRY/$ECR_REPOSITORY:prod |
| 52 | + - name: ECR Logout |
| 53 | + if: always() |
| 54 | + run: docker logout ${{ steps.login-ecr.outputs.registry }} |
0 commit comments