Candysword condition fix #242
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build FolgerCS | |
on: | |
push: | |
branches: [main] | |
paths: | |
- "src/**" | |
- "package.json" | |
pull_request: | |
branches: [main] | |
paths: | |
- "src/**" | |
- "package.json" | |
workflow_dispatch: | |
env: | |
# Default version of Node.js for jobs | |
node-version: "18" | |
jobs: | |
build-push: | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/main' | |
steps: | |
# Checkout source code | |
- name: Checkout | |
uses: actions/checkout@v3 | |
# Setup Nodejs | |
- name: Use Node.js ${{ env.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ env.node-version }} | |
cache: "npm" | |
# Setup Yarn | |
- name: Install yarn | |
run: npm install -g yarn | |
# Install dependencies | |
- name: Install build dependencies | |
run: yarn install | |
# Build script | |
- run: | | |
yarn build | |
mkdir BUILD | |
cp -r KoLmafia/relay BUILD/relay | |
cp -r KoLmafia/scripts BUILD/scripts | |
cp -r KoLmafia/dependencies.txt BUILD/dependencies.txt | |
cp -r README.md BUILD/README.md | |
# Synchronise & push BUILD directory to release branch | |
- name: Configure Git information | |
run: | | |
git config --global user.name "Build Script" | |
git config --global user.email "<>" | |
- name: Synchronize & push into release branch | |
run: | | |
git fetch --all | |
echo "Switching into release" | |
git stash && git stash clear | |
git switch release | |
# Push build into the release branch | |
shopt -s extglob | |
rm -rf !(BUILD) | |
mv BUILD/scripts scripts | |
mv BUILD/relay relay | |
mv BUILD/dependencies.txt dependencies.txt | |
mv BUILD/README.md README.md | |
rm -rf BUILD | |
git add scripts | |
git add relay | |
git add dependencies.txt | |
git add README.md | |
git commit -m "Automated build" | |
git push -f origin release |