📦 admin:create-post:upload-image how-to-effectively-use-twitbooster-f… #289
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: Compile and Build Site | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- master | |
- main | |
- template | |
schedule: | |
- cron: '0 0 1 * *' # every 1st of the month at 12 am UTC | |
concurrency: | |
group: ${{ github.ref }} | |
cancel-in-progress: true | |
# env: | |
# GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
jobs: | |
build: | |
# needs: nothing | |
runs-on: ubuntu-latest | |
timeout-minutes: 80 | |
steps: | |
- name: Setup git config | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "$GITHUB_ACTOR" | |
- name: Checkout main branch | |
uses: actions/checkout@v4 | |
- name: Setup ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: '3.0.0' | |
bundler-cache: false | |
- name: Install specific bundler version | |
run: gem install bundler -v 2.4.21 | |
- name: Run bundle install | |
run: | | |
bundle install --path vendor/bundle | |
- name: Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 10 | |
- name: Run node install | |
run: npm install | |
- name: Log dependency versions | |
run: | | |
echo "Unix Version: " | |
uname -a | |
echo "Ubuntu Version: " | |
lsb_release -a | |
echo "Ruby: $(ruby -v)" | |
echo "Gem: $(gem -v)" | |
echo "Bundler: $(bundle -v)" | |
echo "Node: $(node -v)" | |
echo "NPM: $(npm -v)" | |
echo "Gem Versions: " | |
gem list | |
echo "NPM Dependeny Versions: " | |
npm list --depth=0 || echo "" | |
- name: Run node build | |
run: npm run build -- --buildLocation='server' | |
- name: Create build.json | |
run: | | |
export TZ=UTC date | |
timestamp=$(date +%FT%TZ) | |
temp_build_json=$(cat @output/build/build.json) | |
echo account: $GITHUB_ACTOR | |
echo repo: $GITHUB_REPOSITORY | |
echo timestamp: $timestamp | |
echo build.json: $temp_build_json | |
build_log_path="@output/build/build.json" | |
sed "s/%GHP_TIMESTAMP%/$timestamp/g" $build_log_path > "$build_log_path"-temp && mv "$build_log_path"-temp $build_log_path | |
sed -n '1h;1!H;${;g;s/GEN>>>.*<<<GEN/<REDACTED FOR LIVE PUBLISH>/g;p;}' .gitignore > .gitignore | |
# - name: Delete gh-pages branch | |
# uses: dawidd6/action-delete-branch@v3 | |
# with: | |
# github_token: ${{ secrets.GH_TOKEN }} | |
# branches: gh-pages | |
# soft_fail: true | |
# - name: Delete gh-pages branch | |
# continue-on-error: true | |
# run: | | |
# curl -L \ | |
# -X DELETE \ | |
# -H "Authorization: token ${{ secrets.GH_TOKEN }}" \ | |
# https://api.github.com/repos/$GITHUB_REPOSITORY/git/refs/heads/gh-pages | |
- name: Deploy to gh-pages | |
uses: peaceiris/actions-gh-pages@v4 | |
with: | |
github_token: ${{ secrets.GH_TOKEN }} | |
publish_dir: ./_site | |
- name: Purge CloudFlare cache | |
run: npm run cloudflare:purge | |
- name: Purge artifacts | |
uses: kolpav/purge-artifacts-action@v1 | |
with: | |
token: ${{ secrets.GH_TOKEN }} | |
expire-in: 5 minutes # Set this to 0 to delete instantly | |
# - name: Purge artifacts | |
# uses: c-hive/gha-remove-artifacts@v1 | |
# with: | |
# age: '5 minutes' # '<number> <unit>', e.g. 5 days, 2 years, 90 seconds, parsed by Moment.js | |
# # Optional inputs | |
# # skip-tags: true | |
# # skip-recent: 5 | |
# - name: Purge artifacts | |
# uses: geekyeggo/delete-artifact@v5 | |
# with: | |
# name: github-pages |