Skip to content

Commit

Permalink
Merge pull request #132 from mia-ajuda/215-CD-script
Browse files Browse the repository at this point in the history
215 - Deployment scripts
  • Loading branch information
sudjoao authored Aug 25, 2022
2 parents 00b8048 + 6cda62b commit 40bb3fc
Show file tree
Hide file tree
Showing 6 changed files with 86 additions and 135 deletions.
66 changes: 0 additions & 66 deletions .github/workflows/CI.yml

This file was deleted.

40 changes: 40 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: build, test and lint

on:
push :
branches : [ "**" ]
pull_request:
types: [ opened ]

jobs:
build-test:
runs-on: ubuntu-latest
defaults:
run:
shell: bash

steps:
- name: 🏗 Setup repo
uses: actions/checkout@v3

- name: 🏗 Setup node
uses: actions/setup-node@v3
with:
node-version: lts/*
cache: yarn
cache-dependency-path: yarn.lock

- name: 🏗 Config files
run: |
echo "$FIREBASE_CONFIG_DEV" > ./src/config/firebaseAuthConfig.js
env:
FIREBASE_CONFIG_DEV: ${{ secrets.FIREBASE_CONFIG_DEV }}

- name: 📦 Install dependencies
run: yarn install --pure-lockfile --non-interactive

- name: 📦 Run test
run: yarn test

- name: 📦 Run lint
run: yarn lint
43 changes: 43 additions & 0 deletions .github/workflows/submit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: submit image to dockerhub

on:
push :
branches : [ master, develop ]


jobs:
deploy:
runs-on: ubuntu-latest
env:
IMAGE_NAME: ${{ secrets.DOCKER_REPOSITORY }}:${{ github.sha }}
FIREBASE_CONFIG_DEV: ${{ secrets.FIREBASE_CONFIG_DEV }}
FIREBASE_CONFIG: ${{ secrets.FIREBASE_CONFIG }}
RCLONE_CONFIG: ${{ secrets.RCLONE_CONFIG }}

steps:
- name: 🏗 Setup repo
uses: actions/checkout@v3

- name: 🏗 Config dev files
if: github.ref == 'refs/heads/develop'
run: |
echo "$FIREBASE_CONFIG_DEV" > ./src/config/firebaseAuthConfig.js
echo "$RCLONE_CONFIG" > ./config/rclone.conf
echo "TAG=latest" >> "$GITHUB_ENV"
- name: 🏗 Config prod files
if: github.ref == 'refs/heads/master'
run: |
echo "$FIREBASE_CONFIG" > ./src/config/firebaseAuthConfig.js
echo "$RCLONE_CONFIG" > ./config/rclone.conf
echo "TAG=stable" >> "$GITHUB_ENV"
- name: 📦 Docker login
run: docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_ACCESS_TOKEN }}

- name: 📦 Docker push image
run: |
docker build . -t "$IMAGE_NAME"
docker push "$IMAGE_NAME"
docker tag "$IMAGE_NAME" ${{ secrets.DOCKER_REPOSITORY }}:"$TAG"
docker push ${{ secrets.DOCKER_REPOSITORY }}:"$TAG"
52 changes: 0 additions & 52 deletions .gitlab-ci.yml

This file was deleted.

16 changes: 0 additions & 16 deletions docker-compose.prod.yml

This file was deleted.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
"start:dev": "nodemon index.js",
"dev": "node server.js",
"test": "jest",
"test:coverage": "jest --coverage"
"test:coverage": "jest --coverage",
"lint": "npx eslint ./src",
"lint:fix": "npx eslint ./src --fix"
},
"dependencies": {
"@sentry/node": "5.18.0",
Expand Down

0 comments on commit 40bb3fc

Please sign in to comment.