-
Notifications
You must be signed in to change notification settings - Fork 6
78 lines (75 loc) · 2.83 KB
/
update_publishers.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
---
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}}