Skip to content

publish-site

publish-site #41

Workflow file for this run

name: site-publish
# Publishes Github Site Pages for twitter/util, twitter/scrooge, twitter/finagle,
# twitter/twitter-server, and twitter/finatra
#
# Expects a repository dispatch event: https://developer.github.com/v3/repos/#create-a-repository-dispatch-event
# in the form of JSON data POST to /repos/twitter/dodo/dispatches:
#
# {
# "event_type": "publish-site",
# "client_payload": {
# "dry_run": true
# }
# }
env:
JAVA_OPTS: "-Dsbt.log.noformat=true"
API_USER: ${{ secrets.API_USER }}
API_KEY: ${{ secrets.API_KEY }}
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SCALA_VERSION: "2.13"
REMOTE_BASE: "https://${API_USER}:${API_KEY}@github.com/twitter"
defaults:
run:
shell: bash --noprofile --norc -eux -o pipefail {0}
on:
repository_dispatch:
types: [publish-site]
jobs:
publish-site:
runs-on: ubuntu-latest
steps:
- name: dump/context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- uses: actions/[email protected]
- uses: actions/setup-java@v1
with:
java-version: 1.8
- uses: olafurpg/setup-scala@v10
with:
java-version: [email protected]
- uses: actions/setup-python@v2
with:
python-version: 3.6
- name: setup/sphinx
run: |
sudo apt-get update
sudo apt-get install python3-sphinx
- name: setup/git
run: |
git config --global user.email "${API_USER}@twitter.com"
git config --global user.name "$API_USER"
# publish util site
- name: checkout/util
uses: actions/[email protected]
with:
repository: twitter/util
token: ${{ secrets.API_KEY }}
ref: release
path: util
- name: generate/util
run: |
./sbt --warn util-doc/makeSite
./sbt --warn unidoc
working-directory: ${{ github.workspace }}/util
- name: checkout/util-gh-pages
uses: actions/[email protected]
with:
repository: twitter/util
token: ${{ secrets.API_KEY }}
ref: gh-pages
path: util-gh-pages
- name: publish/util-gh-pages
run: |
touch .nojekyll
cp ${{ github.workspace }}/util/site/index.html .
rm -fr docs/
cp -r ${{ github.workspace }}/util/target/scala-$SCALA_VERSION/unidoc/ docs/
rm -fr guide/
cp -r ${{ github.workspace }}/util/doc/target/site/ guide/
git add .
git commit --allow-empty -m "site publish by $API_USER"
git diff --name-only origin/gh-pages gh-pages
working-directory: ${{ github.workspace }}/util-gh-pages
- name: push/util-gh-pages
if: ${{ !github.event.client_payload.dry_run }}
run: |
git push $REMOTE_BASE/util.git HEAD
working-directory: ${{ github.workspace }}/util-gh-pages
# publish scrooge site
- name: checkout/scrooge
uses: actions/[email protected]
with:
repository: twitter/scrooge
token: ${{ secrets.API_KEY }}
ref: release
path: scrooge
- name: generate/scrooge
run: |
./sbt --warn scrooge-doc/makeSite
working-directory: ${{ github.workspace }}/scrooge
- name: checkout/scrooge-gh-pages
uses: actions/[email protected]
with:
repository: twitter/scrooge
token: ${{ secrets.API_KEY }}
ref: gh-pages
path: scrooge-gh-pages
- name: publish/scrooge-gh-pages
run: |
git rm -fr --ignore-unmatch .
touch .nojekyll
cp -r ${{ github.workspace }}/scrooge/doc/target/site/* .
git add .
git commit --allow-empty -m "site publish by $API_USER"
git diff --name-only origin/gh-pages gh-pages
working-directory: ${{ github.workspace }}/scrooge-gh-pages
- name: push/scrooge-gh-pages
if: ${{ !github.event.client_payload.dry_run }}
run: |
git push $REMOTE_BASE/scrooge.git HEAD
working-directory: ${{ github.workspace }}/scrooge-gh-pages
# publish finagle site
- name: checkout/finagle
uses: actions/[email protected]
with:
repository: twitter/finagle
token: ${{ secrets.API_KEY }}
ref: release
path: finagle
- name: generate/finagle
run: |
./sbt --warn finagle-doc/makeSite
./sbt --warn unidoc
working-directory: ${{ github.workspace }}/finagle
- name: checkout/finagle-gh-pages
uses: actions/[email protected]
with:
repository: twitter/finagle
token: ${{ secrets.API_KEY }}
ref: gh-pages
path: finagle-gh-pages
- name: publish/finagle-gh-pages
run: |
touch .nojekyll
cp ${{ github.workspace }}/finagle/site/index.html .
rm -fr docs/
cp -r ${{ github.workspace }}/finagle/target/scala-$SCALA_VERSION/unidoc/ docs/
rm -fr guide/
cp -r ${{ github.workspace }}/finagle/doc/target/site/ guide/
git add .
git commit --allow-empty -m "site publish by $API_USER"
git diff --name-only origin/gh-pages gh-pages
working-directory: ${{ github.workspace }}/finagle-gh-pages
- name: push/finagle-gh-pages
if: ${{ !github.event.client_payload.dry_run }}
run: |
git push $REMOTE_BASE/finagle.git HEAD
working-directory: ${{ github.workspace }}/finagle-gh-pages
# publish twitter-server site
- name: checkout/twitter-server
uses: actions/[email protected]
with:
repository: twitter/twitter-server
token: ${{ secrets.API_KEY }}
ref: release
path: twitter-server
- name: generate/twitter-server
run: |
./sbt --warn twitterServerDoc/makeSite
working-directory: ${{ github.workspace }}/twitter-server
- name: checkout/twitter-server-gh-pages
uses: actions/[email protected]
with:
repository: twitter/twitter-server
token: ${{ secrets.API_KEY }}
ref: gh-pages
path: twitter-server-gh-pages
- name: publish/twitter-server-gh-pages
run: |
git rm -fr --ignore-unmatch .
touch .nojekyll
cp -r ${{ github.workspace }}/twitter-server/doc/target/site/* .
git add .
git commit --allow-empty -m "site publish by $API_USER"
git diff --name-only origin/gh-pages gh-pages
working-directory: ${{ github.workspace }}/twitter-server-gh-pages
- name: push/twitter-server-gh-pages
if: ${{ !github.event.client_payload.dry_run }}
run: |
git push $REMOTE_BASE/twitter-server.git HEAD
working-directory: ${{ github.workspace }}/twitter-server-gh-pages
# publish finatra site
- name: checkout/finatra
uses: actions/[email protected]
with:
repository: twitter/finatra
token: ${{ secrets.API_KEY }}
ref: release
path: finatra
- name: generate/finatra
run: |
./sbt --warn site/makeSite
./sbt --warn unidoc
working-directory: ${{ github.workspace }}/finatra
- name: checkout/finatra-gh-pages
uses: actions/[email protected]
with:
repository: twitter/finatra
token: ${{ secrets.API_KEY }}
ref: gh-pages
path: finatra-gh-pages
- name: publish/finatra-gh-pages
run: |
git rm -fr --ignore-unmatch .
touch .nojekyll
cp -r ${{ github.workspace }}/finatra/doc/target/site/* .
cp -r ${{ github.workspace }}/finatra/target/scala-$SCALA_VERSION/unidoc/ scaladocs/
git add .
git commit --allow-empty -m "site publish by $API_USER"
git diff --name-only origin/gh-pages gh-pages
working-directory: ${{ github.workspace }}/finatra-gh-pages
- name: push/finatra-gh-pages
if: ${{ !github.event.client_payload.dry_run }}
run: |
git push $REMOTE_BASE/finatra.git HEAD
working-directory: ${{ github.workspace }}/finatra-gh-pages
- name: slack/notification-failure
if: ${{ cancelled() || failure() }}
run: ${{ github.workspace }}/bin/slack --verbose --denote-dry-run ${{ github.event.client_payload.dry_run }} --message "📓 ${{ github.event.client_payload.version }} Site publish \`failed\`." --color "#DA2700"
- name: slack/notification-success
if: ${{ success() }}
run: ${{ github.workspace }}/bin/slack --verbose --denote-dry-run ${{ github.event.client_payload.dry_run }} --message "📓 ${{ github.event.client_payload.version }} Site publish \`successful\`." --color "#229954"