Skip to content

add checks

add checks #20

Workflow file for this run

name: devops testing
on:
push:
branches:
- main
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install dependencies
run: npm install
- name: Run tests
run: npm test
docker:
runs-on: ubuntu-latest
#needs: test
steps:
- name: Set image tag
run: |
COMMIT_MSG="${{ github.event.head_commit.message }}"
if [[ "$COMMIT_MSG" == "[TAG]"* ]]; then
TAG=$(echo $COMMIT_MSG | grep -oP '(?<=\[TAG\])\S+')
echo "TAG=$TAG" >> $GITHUB_ENV
echo "TAG1: $TAG"
else
echo "TAG=latest" >> $GITHUB_ENV
echo "TAG2: $TAG"
fi
#source: https://chatgpt.com/share/66fe5874-6410-8009-ab95-d2fe9956a708
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v3
with:
push: true
tags: ${{ secrets.DOCKERHUB_USER }}/expertlab:${{ env.TAG }}