-
Notifications
You must be signed in to change notification settings - Fork 24
63 lines (54 loc) · 1.99 KB
/
Copy pathupdate-data.yml
File metadata and controls
63 lines (54 loc) · 1.99 KB
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
name: Update data files
on:
workflow_dispatch:
inputs:
data-generator-repo:
required: true
type: string
default: "zhukovsd/interview-prep-hugo-data-generator"
data-generator-branch:
required: true
type: string
default: "master"
jobs:
update-data-files:
runs-on: ubuntu-latest
permissions:
packages: read
env:
LOG_LEVEL: INFO
GOOGLE_APPLICATION_CREDENTIALS: /config/service-account-key.json
GENERATOR_CONFIG_PATH: /config/config.toml
GITHUB_BOT_TOKEN: ${{ secrets.HUB_BOT_TOKEN }}
CREATE_PULL_REQUEST: true
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pull docker image
run: docker pull ghcr.io/${{ inputs.data-generator-repo }}:${{ inputs.data-generator-branch }}
- name: Create google service-account-key.json from github secret
uses: jsdaniell/create-json@v1.2.3
with:
name: service-account-key.json
json: ${{ secrets.GOOGLE_SERVICE_ACCOUNT_KEY }}
dir: ./
- name: Run
run: |
# Read data_dir property from config.toml file
MOUNT_DIR=$(grep -o "mount_dir.*" data-generator-config.toml | cut -d'"' -f2)
docker run \
-e "LOG_LEVEL=$LOG_LEVEL" \
-e "GOOGLE_APPLICATION_CREDENTIALS=$GOOGLE_APPLICATION_CREDENTIALS" \
-e "GENERATOR_CONFIG_PATH=$GENERATOR_CONFIG_PATH" \
-e "GITHUB_BOT_TOKEN=$GITHUB_BOT_TOKEN" \
-e "CREATE_PULL_REQUEST=$CREATE_PULL_REQUEST" \
-v "./:$MOUNT_DIR" \
-v "./data-generator-config.toml:$GENERATOR_CONFIG_PATH" \
-v "./service-account-key.json:$GOOGLE_APPLICATION_CREDENTIALS" \
ghcr.io/${{ inputs.data-generator-repo }}:${{ inputs.data-generator-branch }}