Skip to content

Commit

Permalink
Added github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
teezzan committed Apr 11, 2023
1 parent d1c1a61 commit 40b1f13
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Build and Deploy Docker Container

on:
push:
tags:
- "v*"

jobs:
tests:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Install Dependencies
run: npm install

- name: Run Tests
run: npm test
build:
name: Build & push container
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Node.js environment
uses: actions/setup-node@v2
with:
node-version: "16.x"

- name: Build Docker image
run: docker build -t teehazzan/kitty-facty:${{ github.sha }} .

- name: Log in to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }}

- name: Push Docker image to DockerHub
run: |
docker tag teehazzan/kitty-facty:${{ github.sha }} teehazzan/kitty-facty:latest
docker push teehazzan/kitty-facty:${{ github.sha }}
docker push teehazzan/kitty-facty:latest
18 changes: 18 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Run Tests on Pull Request

on:
pull_request:
branches: [main]

jobs:
tests:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Install Dependencies
run: npm install

- name: Run Tests
run: npm test

0 comments on commit 40b1f13

Please sign in to comment.