Update Inventory Publishers List #244
This file contains 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: Update Inventory Publishers List | |
on: | |
workflow_dispatch: | |
workflow_run: | |
workflows: ["deploy"] | |
types: | |
- completed | |
jobs: | |
update-publishers-staging: | |
name: Update Publishers (Staging) | |
environment: staging | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 2 | |
- name: Get changed files using defaults | |
id: changed-files | |
uses: tj-actions/changed-files@v41 | |
- name: Check if inventory_publishers has changed | |
if: contains(steps.changed-files.outputs.modified_files, 'config/data/inventory_publishers.csv') | |
run: | | |
echo "UPDATE_PUBLISHERS=True" >> $GITHUB_ENV | |
- name: Check if workflow dispatch job | |
if: ${{ github.event_name == 'workflow_dispatch' }} | |
run: | | |
echo "UPDATE_PUBLISHERS=True" >> $GITHUB_ENV | |
- name: Update Publishers | |
if: ${{ env.UPDATE_PUBLISHERS }} | |
# pinned to cf7 until --wait is available for run-task on cf8... | |
# https://github.com/cloudfoundry/cli/issues/2238 | |
uses: cloud-gov/cg-cli-tools@cli-v7 | |
with: | |
command: | | |
cf run-task inventory --command 'ckan dcat-usmetadata import-publishers config/data/inventory_publishers.csv' --wait --name 'update-publishers' | |
cf_org: gsa-datagov | |
cf_space: staging | |
cf_username: ${{secrets.CF_SERVICE_USER}} | |
cf_password: ${{secrets.CF_SERVICE_AUTH}} | |
update-publishers-production: | |
name: Update Publishers (Production) | |
environment: production | |
runs-on: ubuntu-latest | |
needs: | |
- update-publishers-staging | |
steps: | |
- name: checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 2 | |
- name: Get changed files using defaults | |
id: changed-files | |
uses: tj-actions/changed-files@v41 | |
- name: Check if inventory_publishers has changed | |
if: contains(steps.changed-files.outputs.modified_files, 'config/data/inventory_publishers.csv') | |
run: | | |
echo "UPDATE_PUBLISHERS=True" >> $GITHUB_ENV | |
- name: Check if workflow dispatch job | |
if: ${{ github.event_name == 'workflow_dispatch' }} | |
run: | | |
echo "UPDATE_PUBLISHERS=True" >> $GITHUB_ENV | |
- name: Update Publishers | |
if: ${{ env.UPDATE_PUBLISHERS }} | |
# pinned to cf7 until --wait is available for run-task on cf8... | |
# https://github.com/cloudfoundry/cli/issues/2238 | |
uses: cloud-gov/cg-cli-tools@cli-v7 | |
with: | |
command: | | |
cf run-task inventory --command 'ckan dcat-usmetadata import-publishers config/data/inventory_publishers.csv' --wait --name 'update-publishers' | |
cf_org: gsa-datagov | |
cf_space: prod | |
cf_username: ${{secrets.CF_SERVICE_USER}} | |
cf_password: ${{secrets.CF_SERVICE_AUTH}} |