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: Release to Clojars and Trigger a PR in yetibot/yetibot | |
on: | |
push: | |
branches: | |
# master always auto releases | |
- master | |
jobs: | |
test: | |
# Containers must run in Linux based operating systems | |
runs-on: ubuntu-latest | |
# Docker Hub image that `container-job` executes in | |
container: clojure:lein-bullseye | |
services: | |
# Label used to access the service container | |
postgres: | |
# Docker Hub image | |
image: postgres | |
# Provide the password for postgres | |
env: | |
POSTGRES_USER: yetibot | |
POSTGRES_PASSWORD: yetibot | |
# Set health checks to wait until postgres has started | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
steps: | |
- name: checkout | |
uses: actions/checkout@v2 | |
- name: maven cache | |
uses: actions/cache@v2 | |
with: | |
path: /root/.m2/repository | |
key: ${{ runner.os }}-maven-${{ hashFiles('project.clj') }} | |
restore-keys: | | |
${{ runner.os }}-maven- | |
- name: install git | |
run: apt-get update && apt-get -y install git | |
# runs the tests and generates code coverage metrics | |
- name: test | |
env: | |
YETIBOT_DB_URL: postgresql://yetibot:yetibot@postgres:5432/yetibot | |
CLOVERAGE_VERSION: 1.1.2 | |
run: lein with-profile +test cloverage --codecov --runner midje | |
deploy: | |
runs-on: ubuntu-latest | |
needs: test | |
steps: | |
- name: checkout | |
uses: actions/checkout@v2 | |
- uses: actions/setup-java@v1 | |
with: | |
java-version: 1.11 | |
- uses: DeLaGuardo/setup-clojure@master | |
with: | |
lein: 2.9.4 | |
- name: maven cache | |
uses: actions/cache@v2 | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven-${{ hashFiles('project.clj') }} | |
restore-keys: | | |
${{ runner.os }}-maven- | |
- name: timestamp | |
# by setting INFERV_TIMESTAMP_MS we will get deterministic versions from | |
# `lein pprint :version` | |
run: echo "INFERV_TIMESTAMP_MS=`date +%s%3N`" >> $GITHUB_ENV | |
- name: version | |
run: echo "YB_VERSION=`lein pprint :version | sed 's/\"//g'`" >> $GITHUB_ENV | |
- name: verify | |
run: env | |
# Clojars | |
- name: Clojars release | |
env: | |
CLOJARS_USERNAME: ${{ secrets.CLOJARS_USERNAME }} | |
CLOJARS_PASSWORD: ${{ secrets.CLOJARS_PASSWORD }} | |
run: lein with-profile deploy release | |
- name: Trigger yetibot to bump dep | |
uses: mvasigh/dispatch-action@main | |
with: | |
token: ${{ secrets.YETIBOT_GITHUB_TOKEN }} | |
repo: yetibot | |
owner: yetibot | |
event_type: bump | |
message: | | |
{ | |
"yb_version": "${{ env.YB_VERSION }}" | |
} |