-
Notifications
You must be signed in to change notification settings - Fork 2
87 lines (75 loc) · 3.07 KB
/
dev-tableau-update.yml
File metadata and controls
87 lines (75 loc) · 3.07 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
name: "Daily Tableau Data Update"
on:
schedule:
# This runs at 10:00 AM UTC every day
- cron: '0 10 * * *'
workflow_dispatch: # manual run for testing
jobs:
metadata:
name: "Set CI/CD metadata"
runs-on: ubuntu-latest
timeout-minutes: 1
outputs:
build_datetime: ${{ steps.variables.outputs.build_datetime }}
build_timestamp: ${{ steps.variables.outputs.build_timestamp }}
build_epoch: ${{ steps.variables.outputs.build_epoch }}
nodejs_version: ${{ steps.variables.outputs.nodejs_version }}
python_version: ${{ steps.variables.outputs.python_version }}
terraform_version: ${{ steps.variables.outputs.terraform_version }}
version: ${{ steps.variables.outputs.version }}
steps:
- name: "Checkout code"
uses: actions/checkout@v6
with:
ref: ${{ github.ref_name }}
- name: "Set CI/CD variables"
id: variables
run: |
datetime=$(date -u +'%Y-%m-%dT%H:%M:%S%z')
echo "build_datetime=$datetime" >> $GITHUB_OUTPUT
echo "build_timestamp=$(date --date=$datetime -u +'%Y%m%d%H%M%S')" >> $GITHUB_OUTPUT
echo "build_epoch=$(date --date=$datetime -u +'%s')" >> $GITHUB_OUTPUT
echo "nodejs_version=$(grep '^nodejs' .tool-versions | cut -f2 -d' ')" >> $GITHUB_OUTPUT
echo "python_version=$(grep '^python' .tool-versions | cut -f2 -d' ')" >> $GITHUB_OUTPUT
echo "terraform_version=$(grep '^terraform' .tool-versions | cut -f2 -d' ')" >> $GITHUB_OUTPUT
echo "version=dev-$(date +'%Y%m%d%H%M%S')" >> $GITHUB_OUTPUT
- name: "List variables"
run: |
echo "Deploying to: DEV"
echo "VERSION=${{ steps.variables.outputs.version }}"
publish:
name: "Publish to dev"
runs-on: ubuntu-latest
needs: [metadata]
timeout-minutes: 30
environment: "dev"
permissions:
id-token: write
contents: write
steps:
- name: "Set up Python"
uses: actions/setup-python@v6
with:
python-version: '3.13'
- name: "Checkout Repository"
uses: actions/checkout@v6
with:
ref: ${{ github.ref_name }}
- name: "Install Dependencies"
run: |
pip install boto3 pandas tableauserverclient tableauhyperapi requests
- name: "Configure AWS Credentials (Main Deployment Role)"
uses: aws-actions/configure-aws-credentials@v6
with:
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/service-roles/github-actions-api-deployment-role
aws-region: eu-west-2
- name: "Run S3 to Hyper Script"
run: python scripts/tableau/generate_tableau_data.py
- name: "Publish to Tableau"
env:
TABLEAU_TOKEN_NAME: ${{ secrets.TABLEAU_TOKEN_NAME }}
TABLEAU_TOKEN_VALUE: ${{ secrets.TABLEAU_TOKEN_VALUE }}
TABLEAU_SITE_ID: ${{ vars.TABLEAU_SITE_ID }}
TABLEAU_SERVER_URL: ${{ vars.TABLEAU_SERVER_URL }}
TABLEAU_DATASOURCE_ID: ${{ secrets.TABLEAU_DATASOURCE_ID }}
run: python scripts/tableau/tableau_refresh.py