🛫 Promote a Dataset to Draft: db-pluto ar-pluto-26v1 #171
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 }} ${{ inputs.build }}" | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| product: | |
| description: "Data product name (folder name in S3 publishing bucket)" | |
| type: choice | |
| required: true | |
| options: | |
| - db-cbbr | |
| - db-cdbg | |
| - db-ceqr | |
| - db-checkbook | |
| - db-colp | |
| - db-cpdb | |
| - db-developments | |
| - db-eddt | |
| - 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 | |
| create_qa_github_issue: | |
| description: "Create Github Issue for product QA?" | |
| type: boolean | |
| default: false | |
| required: true | |
| 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 | |
| create_qa_github_issue: | |
| type: boolean | |
| 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 | |
| .github | |
| - 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 }} | |
| - name: Set version and draft number | |
| run: | | |
| echo "version=$(cat build_metadata.json | jq -r .version)" >> $GITHUB_ENV | |
| echo "draft_number=$(cat build_metadata.json | jq -r .draft_revision_name)" >> $GITHUB_ENV | |
| - name: Create Github Issue for QA | |
| if: ${{ inputs.create_qa_github_issue }} | |
| uses: JasonEtco/create-an-issue@v2 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| PROMOTE_TO_DRAFT_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | |
| PRODUCT: ${{ inputs.product }} | |
| VERSION: ${{ env.version }} | |
| DRAFT: ${{ env.draft_number }} | |
| with: | |
| filename: .github/ISSUE_TEMPLATE/product_qa.md | |
| update_existing: false |