🛫 Promote a Dataset to Draft: db-developments #80
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: 🛫 Promote a Dataset to Draft | |
| run-name: "🛫 Promote a Dataset to Draft: ${{ inputs.product }}" | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| product: | |
| description: "Data product name (folder name in S3 publishing bucket)" | |
| type: choice | |
| required: true | |
| options: | |
| - db-cbbr | |
| - db-checkbook | |
| - db-colp | |
| - db-cpdb | |
| - db-developments | |
| - db-facilities | |
| - db-green-fast-track | |
| - db-pluto | |
| - db-zoningtaxlots | |
| - db-template | |
| build: | |
| description: "Build folder to promote" | |
| type: string | |
| required: true | |
| draft_summary: | |
| description: "Draft revision summary (becomes a part of draft name in s3)" | |
| type: string | |
| required: false | |
| default: '' | |
| product_acl: | |
| description: "Set access control list for output in DO" | |
| type: choice | |
| required: true | |
| default: public-read | |
| options: | |
| - public-read | |
| - private | |
| dev_bucket: | |
| description: "dev bucket to use in place of edm-publishing. If name of bucket is 'de-dev-a' simply put 'a'" | |
| type: string | |
| required: false | |
| workflow_call: | |
| inputs: | |
| product: | |
| type: string | |
| required: true | |
| build: | |
| type: string | |
| required: true | |
| draft_summary: | |
| type: string | |
| required: false | |
| default: '' | |
| product_acl: | |
| type: string | |
| required: true | |
| dev_bucket: | |
| type: string | |
| default: false | |
| jobs: | |
| promote: | |
| runs-on: ubuntu-22.04 | |
| defaults: | |
| run: | |
| shell: bash | |
| container: | |
| image: nycplanning/build-base:latest | |
| env: | |
| PUBLISHING_BUCKET: ${{ inputs.dev_bucket && format('de-dev-{0}', inputs.dev_bucket) || 'edm-publishing' }} | |
| DEV_FLAG: ${{ inputs.dev_bucket && 'true' || 'false' }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| sparse-checkout: | | |
| dcpy | |
| bash | |
| admin/run_environment | |
| - name: Load Secrets | |
| uses: 1password/load-secrets-action@v1 | |
| with: | |
| export-env: true | |
| env: | |
| OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN }} | |
| AWS_S3_ENDPOINT: "op://Data Engineering/DO_keys/AWS_S3_ENDPOINT" | |
| AWS_SECRET_ACCESS_KEY: "op://Data Engineering/DO_keys/AWS_SECRET_ACCESS_KEY" | |
| AWS_ACCESS_KEY_ID: "op://Data Engineering/DO_keys/AWS_ACCESS_KEY_ID" | |
| BUILD_ENGINE_SERVER: "op://Data Engineering/EDM_DATA/server_url" | |
| - name: Finish container setup | |
| working-directory: ./ | |
| run: ./bash/docker_container_setup.sh | |
| - name: Promote Build to Draft | |
| run: | | |
| python3 -m dcpy.connectors.edm.publishing promote_to_draft \ | |
| --product ${{ inputs.product }} \ | |
| --build ${{ inputs.build }} \ | |
| ${{ (inputs.draft_summary != '' && format('--draft-summary {0}', inputs.draft_summary)) || ''}} \ | |
| --acl ${{ inputs.product_acl }} |