Skip to content

added workflow dispatch to be able to run workflow manually #246

added workflow dispatch to be able to run workflow manually

added workflow dispatch to be able to run workflow manually #246

Workflow file for this run

# 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
strategy:
matrix:
#node-version: [12.x, 14.x, 15.x]
node-version: [15.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Cache Node Modules
id: node-cache
uses: actions/cache@v2
with:
path: node_modules
key: node-modules-${{ hashFiles('package-lock.json') }}
- name: Install dependenceis
if: steps.node-cache.outputs.cache-hit != 'true'
run: npm ci
- run: npm run build --if-present
- run: npm test
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/[email protected]
with:
tags: # optional
fotogjengen/hilfling-frontend:latest
push: true #optional, default is false
- name: "Build app outside docker"
run: "npm ci && npm run build"
- uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
automatic_release_tag: "latest"
prerelease: true
files: ./build/
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run eslint with reviewdog
# You may pin to the exact commit or the version.
# uses: reviewdog/action-eslint@c93d1f8efe07ce3b9b2d186ceaa5cd6ced717633
uses: reviewdog/[email protected]
with:
# GITHUB_TOKEN.
github_token: ${{ secrets.GITHUB_TOKEN }}
# Report level for reviewdog [info,warning,error]
level: error # optional, default is error
reporter: github-pr-review