Skip to content

BREAKING CHANGE: fix: prod resource path (#15) #7

BREAKING CHANGE: fix: prod resource path (#15)

BREAKING CHANGE: fix: prod resource path (#15) #7

Workflow file for this run

name: Build, Upload & Deploy
on:
push:
branches:
- main
paths-ignore:
- "chore(release):*"
jobs:
check-commit-message:
name: Check Commit Message
runs-on: ubuntu-latest
outputs:
should_run: ${{ steps.check_commit.outputs.should_run }}
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Get commit message
id: commit_message
run: echo "::set-output name=message::$(git log -1 --pretty=%B)"
- name: Determine if workflow should run
id: check_commit
run: |
if [[ "${{ steps.commit_message.outputs.message }}" == *"chore(release):"* ]]; then
echo "::set-output name=should_run::false"
else
echo "::set-output name=should_run::true"
fi
release:
name: Release
runs-on: ubuntu-latest
needs: check-commit-message
if: needs.check-commit-message.outputs.should_run == 'true'
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: "18"
- name: Install dependencies
run: npm ci
- name: Set Git user
run: |
git config user.email "github-actions@github.com"
git config user.name "GitHub Action Bot"
- name: Create release
run: npm run release
- name: Push changes and tags
run: git push --follow-tags origin main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Build project
env:
REACT_APP_CHATBOT_API_URL: ${{ vars.REACT_APP_CHATBOT_API_URL }}
run: echo "REACT_APP_CHATBOT_API_URL set in env is ${{ env.REACT_APP_CHATBOT_API_URL }}" && npm run build
- name: Upload production-ready build files
uses: actions/upload-artifact@v3
with:
name: production-files
path: ./build
deploy:
name: Deploy
needs: [release, check-commit-message]
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: production-files
path: ./build
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./build