Skip to content

Commit

Permalink
ci: setup github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
wnqueiroz committed May 21, 2021
1 parent 78f8481 commit bb7c746
Show file tree
Hide file tree
Showing 4 changed files with 130 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Build checking

on: pull_request

jobs:
code:
name: Build checking
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set up Node.js
uses: actions/setup-node@v1
with:
node-version: 14.x

- name: Install dependencies
uses: bahmutov/npm-install@v1

- name: Run TypeScript
run: npm run build --if-present
62 changes: 62 additions & 0 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: CI/CD

on:
push:
branches: [main]

jobs:
build:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[ci skip]')"

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
token: ${{ secrets.GH_ADMIN_TOKEN }}

- name: Set up Node.js
uses: actions/setup-node@v1
with:
node-version: 14.x

- name: Install dependencies
uses: bahmutov/npm-install@v1

- name: Build
run: npm run build --if-present

# TODO: add CODECOV_TOKEN secret to repository when use this
# - name: Get test coverage
# run: npm run test:cov

# - name: Upload coverage to Codecov
# uses: codecov/codecov-action@v1
# with:
# token: ${{ secrets.CODECOV_TOKEN }}

- name: Bump version and push changes
run: |
git config --global user.name ${{ secrets.GH_USERNAME }}
git config --global user.email ${{ secrets.GH_EMAIL }}
npm run release
git push --follow-tags
- name: Read version from package.json
uses: tyankatsu0105/read-package-version-actions@v1
id: package-version

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Push to DockerHub
id: docker_build
uses: docker/build-push-action@v2
with:
push: true
tags: |
${{ secrets.DOCKER_REPOSITORY }}:${{ steps.package-version.outputs.version }}
${{ secrets.DOCKER_REPOSITORY }}:latest
24 changes: 24 additions & 0 deletions .github/workflows/lint-code.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Lint

on: pull_request

jobs:
code:
name: Lint code
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set up Node.js
uses: actions/setup-node@v1
with:
node-version: 14.x

- name: Install dependencies
uses: bahmutov/npm-install@v1

- name: Run ESLint
run: npm run lint
20 changes: 20 additions & 0 deletions .github/workflows/lint-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Lint commit

on: pull_request

jobs:
commit:
name: Lint commit messages
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Install dependencies
uses: bahmutov/npm-install@v1

- name: Check commit message
uses: wagoid/commitlint-github-action@v3

0 comments on commit bb7c746

Please sign in to comment.