Skip to content

🤖 auto update stage ⬆️ #220

🤖 auto update stage ⬆️

🤖 auto update stage ⬆️ #220

Workflow file for this run

name: Production Release
on:
push:
branches:
- main
jobs:
deploy-prod:
name: Check Release
runs-on: ubuntu-latest
steps:
- name: Checkout Actions
if: github.ref == 'refs/heads/main'
uses: actions/checkout@v4
with:
ref: ${{github.ref}}
persist-credentials: false
- name: Check Release
id: check_release
run: |
LAST_COMMIT_MESSAGE=`git log --pretty=format:%s -1`
PR_NUM=`echo "${LAST_COMMIT_MESSAGE}" | grep -o "#[[:digit:]].." | sed -e 's/#//' | head -1`
if [ ! -z "$PR_NUM" ] ; then \
TITLE=`echo "$LAST_COMMIT_MESSAGE" | grep -e "release" -e "Release"`
if [ ! -z "$TITLE" ] ; then \
echo "release=true" >> $GITHUB_OUTPUT
fi
fi
- name: Setup Hugo
if: steps.check_release.outputs.release == 'true'
uses: peaceiris/actions-hugo@v2
with:
hugo-version: latest
- name: Setup for Build
if: steps.check_release.outputs.release == 'true'
run: |
git config --global user.name "vdaas-ci"
git config --global user.email "[email protected]"
git remote set-url origin "https://${GITHUB_USER}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
git submodule update --init --recursive
cd public
git remote set-url origin "https://${GITHUB_USER}:${GITHUB_TOKEN}@github.com/vdaas/vald.git"
git checkout gh-pages
git pull origin gh-pages
env:
GITHUB_USER: ${{ secrets.DISPATCH_USER }}
GITHUB_TOKEN: ${{ secrets.DISPATCH_TOKEN }}
- name: Production Build
if: steps.check_release.outputs.release == 'true'
run: |
make build/prod
- name: Check Changes public
id: git_diff_preview
run: |
diff=`git diff public/`
if [ ! -z "$diff" ] ; then \
echo "diff=true" >> $GITHUB_OUTPUT
fi
- name: Production Deploy
if: steps.git_diff_preview.outputs.diff
run: |
export LATEST_VERSION=$(make version/latest)
cd public
git checkout gh-pages
git add .
git commit --signoff -m ":arrow_up: v${LATEST_VERSION} `date`"
git push origin gh-pages
env:
GITHUB_USER: ${{ secrets.DISPATCH_USER }}
GITHUB_TOKEN: ${{ secrets.DISPATCH_TOKEN }}
- name: Commit Production Changes
if: steps.git_diff_preview.outputs.diff
run: |
git checkout main
git diff
git branch
git log --oneline -n1
git add public
git commit --signoff -m ":robot: auto update production :arrow_up:"
git push origin ${{ github.head_ref }}
env:
GITHUB_USER: ${{ secrets.DISPATCH_USER }}
GITHUB_TOKEN: ${{ secrets.DISPATCH_TOKEN }}