diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 00000000..11993faa --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,76 @@ +name: Build and Deploy + +on: + push: + branches: + - source + pull_request: + branches: + - source + +permissions: + contents: write + +jobs: + build-and-deploy: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Java + uses: actions/setup-java@v4 + with: + distribution: 'zulu' + java-version: '17' + + - name: Set up Leiningen + uses: DeLaGuardo/setup-clojure@13.4 + with: + lein: 'latest' + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Install Sass + run: npm install -g sass + + - name: Maven cache + uses: actions/cache@v4 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('project.clj') }} + restore-keys: | + ${{ runner.os }}-maven- + + - name: Build site + run: lein run + + - name: Copy CNAME + run: cp CNAME resources/public/CNAME + + - name: Deploy to GitHub Pages + if: github.event_name == 'push' && github.ref == 'refs/heads/source' + uses: JamesIves/github-pages-deploy-action@v4 + with: + branch: master + folder: resources/public + + - name: Purge Cloudflare Cache + if: github.event_name == 'push' && github.ref == 'refs/heads/source' + env: + CLOUDFLARE_ZONE: ${{ secrets.CLOUDFLARE_ZONE }} + CLOUDFLARE_EMAIL: ${{ secrets.CLOUDFLARE_EMAIL }} + CLOUDFLARE_TOKEN: ${{ secrets.CLOUDFLARE_TOKEN }} + run: | + if [ -n "$CLOUDFLARE_ZONE" ]; then + curl -X DELETE "https://api.cloudflare.com/client/v4/zones/$CLOUDFLARE_ZONE/purge_cache" \ + -H "X-Auth-Email: $CLOUDFLARE_EMAIL" \ + -H "X-Auth-Key: $CLOUDFLARE_TOKEN" \ + -H "Content-Type: application/json" \ + --data '{"purge_everything":true}' + else + echo "Cloudflare zone not set, skipping cache purge" + fi diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 62aa9927..00000000 --- a/.travis.yml +++ /dev/null @@ -1,37 +0,0 @@ -language: clojure - -branches: - only: - - source - -sudo: required - -cache: - directories: - - $HOME/.m2 - -before_install: -- gem install sass - -script: -- lein run - -deploy: - provider: pages - skip-cleanup: true - github-token: $GITHUB_TOKEN # Set in travis-ci.org dashboard, marked secure - keep-history: true - fqdn: yetibot.com - target-branch: master - local-dir: resources/public - on: - branch: source - -after_success: - - | - curl -X DELETE - "https://api.cloudflare.com/client/v4/zones/$CLOUDFLARE_ZONE/purge_cache" - -H "X-Auth-Email: $CLOUDFLARE_EMAIL" - -H "X-Auth-Key: $CLOUDFLARE_TOKEN" - -H "Content-Type: application/json" - --data '{"purge_everything":true}' diff --git a/README.md b/README.md index 81da08dd..2b985455 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # yetibot.github.io -[![Build Status](https://travis-ci.org/yetibot/yetibot.github.io.svg?branch=source)](https://travis-ci.org/yetibot/yetibot.github.io) +[![Build Status](https://github.com/yetibot/yetibot.github.io/actions/workflows/deploy.yml/badge.svg?branch=source)](https://github.com/yetibot/yetibot.github.io/actions/workflows/deploy.yml) This is the static site generator source for [https://yetibot.com](https://yetibot.com). @@ -15,7 +15,7 @@ It's built on [Cryogen](http://cryogenweb.org/). e.g. ``` - gem install sass + npm install -g sass ``` - [yarn or npm](https://yarnpkg.com/en/)