added workflow dispatch #151
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
# CI-CD | |
# Runs on push to master | |
name: CI-CD | |
# Controls when the action will run. | |
on: | |
# Triggers the workflow on push or pull request events but only for the master branch | |
push: | |
branches: [ master ] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Build docker stack | |
run: | | |
docker network create traefik | |
docker-compose -f docker-compose.yml -f docker-compose.test.yml up run-tests | |
# This workflow contains a single job called "build" | |
build-and-deploy: | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
needs: test | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Login to DockerHub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push Docker images | |
# You may pin to the exact commit or the version. | |
# uses: docker/build-push-action@0db984c1826869dcd0740ff26ff75ff543238fd9 | |
uses: docker/build-push-action@v2.2.1 | |
with: | |
tags: # optional | |
fotogjengen/hilfling-backend:latest | |
push: true #optional, default is false | |
- name: "Package app outside docker" | |
run: "mvn clean package spring-boot:repackage" | |
- name: "Publish package to Github Releases" | |
uses: "marvinpinto/action-automatic-releases@latest" | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
automatic_release_tag: "latest" | |
prerelease: true | |
title: "Development Build" | |
files: ./target/* | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Run ktlint with reviewdog | |
# You may pin to the exact commit or the version. | |
# uses: ScaCap/action-ktlint@58b3c386f5160049b0a1d0f986c56e0d0717140a | |
uses: ScaCap/action-ktlint@1.3 | |
with: | |
# GITHUB_TOKEN | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
# Report level for reviewdog [info,warning,error] | |
level: error# optional, default is error | |
# Reporter of reviewdog command [github-pr-check,github-pr-review]. | |
reporter: github-pr-check # optional, default is github-pr-check | |
# Fails the current check if any error was found [true/false] | |
fail_on_error: false # optional, default is false | |
# Print files relative to the working directory | |
relative: true # optional, default is true | |
# Run KtLint with Android Kotlin Style Guide |