Skip to content

Vtd config

Vtd config #19

Workflow file for this run

name: Vtd config
on:
schedule:
- cron: 0 0/12 * * *
workflow_dispatch:
permissions:
contents: write
jobs:
run:
name: Run ${{ matrix.env }}
environment: ${{ matrix.env }}
runs-on: ubuntu-latest
continue-on-error: true
strategy:
fail-fast: true
matrix:
include:
- env: dev
- env: stg
- env: prd
steps:
- name: Call update /api/app-config
run: |
mkdir ${{ matrix.env }}
curl -X GET ${{ vars.BASE_URL }}/api/app-config -H "Content-Type: application/json" -o ./${{ matrix.env }}/app-config.json
- name: Upload to artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.env }}
path: ${{ matrix.env }}/app-config.json
if-no-files-found: warn
after-run:
name: After run
needs: [run]
runs-on: ubuntu-latest
steps:
- name: Download from artifact
uses: actions/download-artifact@v4
with:
path: ./tmp
- name: Checkout source
uses: actions/checkout@v4
with:
repository: ${{ secrets.STATIC_WEB_REPOSITORY }}
token: ${{ secrets.GH_PAT }}
path: source
- name: Move file
run: |
# DEV environment
if [ -f ./tmp/dev/app-config.json ]; then
echo move dev
rm -rf ./source/dev/conf/app-config.json
mv ./tmp/dev/app-config.json ./source/dev/conf/app-config.json
fi
# STG environment
if [ -f ./tmp/stg/app-config.json ]; then
echo move stg
rm -rf ./source/stg/conf/app-config.json
mv ./tmp/stg/app-config.json ./source/stg/conf/app-config.json
fi
# PRD environment
if [ -f ./tmp/prd/app-config.json ]; then
echo move prd
rm -rf ./source/prd/conf/app-config.json
mv ./tmp/prd/app-config.json ./source/prd/conf/app-config.json
fi
- name: Commit
working-directory: source
run: |
git config user.name "GitHub Actions"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add -A
git diff-index --quiet HEAD || git commit -m ':white_check_mark: Update'
git push origin main -f