Skip to content

Add OpenADE Task Force December 4, 2024 Meeting Minutes #39

Add OpenADE Task Force December 4, 2024 Meeting Minutes

Add OpenADE Task Force December 4, 2024 Meeting Minutes #39

Workflow file for this run

name: Website Build
on:
push:
branches:
- main
jobs:
WebsiteBuild:
runs-on: ubuntu-latest
env:
BUNDLE_GEMFILE: ${{ github.workspace }}/main-branch/website/Gemfile
steps:
- name: Checkout main branch
uses: actions/checkout@v3
with:
ref: main
path: main-branch
- name: Checkout gh-pages branch
uses: actions/checkout@v3
with:
ref: gh-pages
path: gh-pages-branch
- name: Setup ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0'
bundler-cache: true
- name: Replace placeholder files with original files
run: |
# set source and website directories
export WEBSITE_DIR="${{ github.workspace }}/main-branch/website/_includes/update_copies"
export WEBSITE_DIR="${{ github.workspace }}/main-branch/website/_includes/correction_copies"
export SOURCE_DIR="${{ github.workspace }}/main-branch/espi_updates"
export SOURCE_DIR="${{ github.workspace }}/main-branch/espi_corrections"
# remove any existing placeholder files
find \
$WEBSITE_DIR \
-type f \
-path "$WEBSITE_DIR/placeholder_*.md" \
| xargs -I% \
rm %
# copy original files to website directory
find \
$SOURCE_DIR \
-type f \
-path "$SOURCE_DIR/*.md" \
-not -path "*/README.md" \
-printf "%f\n" \
| xargs -I% \
cp $SOURCE_DIR/% $WEBSITE_DIR/placeholder_%
# update specifications source base url with current repo and branch
echo "github_specs_base_url: \"https://github.com/${{ github.repository }}/blob/${{ github.ref_name
}}/ESPI-updates\"" \
>> ${{ github.workspace }}/main-branch/website/_config.yml
# default base url is root of domain
echo "baseurl: /" \
>> ${{ github.workspace }}/main-branch/website/_config.yml
- name: Non-production builds use Github Page's default base url (/openADE-task-force/)
if: ${{ github.repository != 'GreenButtonAlliance/openADE-task-force' }}
run: |
sed -i \
's|baseurl: \/|baseurl: /openADE-task-force/|g' \
${{ github.workspace }}/main-branch/website/_config.yml
- name: Build static website
run: |
cd ${{ github.workspace }}/main-branch/website
bundle exec jekyll build -d ${{ github.workspace }}/gh-pages-branch
- name: Set production domain
if: ${{ github.repository == 'GreenButtonAlliance/openADE-task-force' }}
run: |
echo -n "greenbuttonalliance.org" > ${{ github.workspace }}/gh-pages-branch/CNAME
- name: Push static site to gh-pages branch
run: |
cd ${{ github.workspace }}/gh-pages-branch
git config user.name github-actions
git config user.email [email protected]
# only commit and push if there's actually things commit
if [ $(git status --short | wc -l) -ne 0 ]; then
echo "Pushing website changes to gh-pages..."
git add -A
git commit -m "[bot] Github Pages build"
git push
else
echo "No changes on website"
fi