tenebrous-dicebot/.github/workflows/dicebot-ci.yml

67 lines
1.5 KiB
YAML
Raw Normal View History

name: Dicebot CI
2020-08-31 20:24:57 +00:00
on:
push:
branches:
- master
# Publish `v1.2.3` tags as releases.
tags:
- v*
# Run tests for any PRs.
pull_request:
env:
IMAGE_NAME: chronicle-dicebot
CARGO_TERM_COLOR: always
2020-08-31 20:24:57 +00:00
jobs:
build_and_test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
docker_push_latest:
needs: build_and_test
2020-08-31 20:24:57 +00:00
runs-on: ubuntu-latest
if: github.event_name == 'push'
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Build and push Docker images
uses: docker/build-push-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
2020-08-31 22:06:35 +00:00
repository: projectmoon/chronicle-dicebot
tags: latest
2020-08-31 21:40:42 +00:00
push: ${{ github.ref == 'refs/heads/master' }}
docker_push_tag:
needs: build_and_test
2020-08-31 20:24:57 +00:00
runs-on: ubuntu-latest
if: github.event_name == 'push'
2020-08-31 20:24:57 +00:00
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Build and push Docker images
uses: docker/build-push-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
2020-08-31 22:06:35 +00:00
repository: projectmoon/chronicle-dicebot
tags: latest
tag_with_ref: true
push: ${{ startsWith(github.ref, 'refs/tags/') }}