PSF-BotServer/.github/workflows/publish.yaml

57 lines
1.7 KiB
YAML

name: Publish
on: [push]
jobs:
docs:
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Cache SBT
uses: actions/cache@v2
with:
path: |
~/.ivy2/cache
~/.sbt
key: ${{ runner.os }}-sbt-${{ hashFiles('**/build.sbt') }}
- name: Checkout
uses: actions/checkout@v2
- name: Setup Scala
uses: olafurpg/setup-scala@v12
- name: Build docs
run: sbt docs/unidoc
- name: Deploy to GitHub Pages
uses: JamesIves/github-pages-deploy-action@4.1.4
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
FOLDER: docs/target/scala-2.13/unidoc
docker:
runs-on: ubuntu-latest
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Set variables
id: prep
run: |
DOCKER_IMAGE=server
REPOSITORY="$(echo $GITHUB_REPOSITORY | tr '[:upper:]' '[:lower:]')"
TAGS="ghcr.io/${REPOSITORY}/${DOCKER_IMAGE}:${GITHUB_SHA}"
if [ "${{ github.ref }}" = "refs/heads/master" ]; then
TAGS="$TAGS,ghcr.io/${REPOSITORY}/${DOCKER_IMAGE}:latest,ghcr.io/${REPOSITORY}/${DOCKER_IMAGE}:master"
fi
echo ::set-output name=tags::${TAGS}
- name: Log in to GitHub Docker Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build container image
uses: docker/build-push-action@v2
with:
push: true
tags: ${{ steps.prep.outputs.tags }}