Replace travis with GitHub actions

This commit is contained in:
ErickSkrauch 2021-03-28 01:44:44 +01:00
parent 6a65e714ff
commit 485493f184
No known key found for this signature in database
GPG Key ID: 669339FCBB30EE0E
2 changed files with 64 additions and 34 deletions

64
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,64 @@
name: CI
on:
push:
pull_request:
jobs:
Build:
runs-on: ubuntu-20.04
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: 12
- id: cache-node-modules
name: Download cache
uses: actions/cache@v2
with:
path: node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/yarn.lock') }}
- name: Install dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: yarn install
- name: ESLint
run: yarn lint
- name: TypeScript
run: yarn tsc
- name: Build
run: yarn build
- name: Upload build artifacts
uses: actions/upload-artifact@v2
with:
name: build
path: dist
retention-days: 7
Docker:
runs-on: ubuntu-20.04
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
steps:
- name: Login to the GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v2
with:
target: app
tags: ghcr.io/${{ github.repository }}:latest
push: true
cache-from: type=registry,ref=ghcr.io/${{ github.repository }}:latest
cache-to: type=inline

View File

@ -1,34 +0,0 @@
language: node_js
node_js:
- "12"
cache:
yarn: true
directories:
- node_modules
stages:
- test
- name: deploy
if: branch = master
jobs:
include:
- stage: test
script:
- yarn lint
- yarn tsc
- yarn build:quiet
- stage: deploy
services:
- docker
before_script:
- docker login -u="$DOCKER_USERNAME" -p="$DOCKER_PASSWORD"
script:
- export DOCKER_TAG="${TRAVIS_TAG:-dev}"
- >
docker build
--target app
-t elyby/emails-renderer:$DOCKER_TAG
.
- docker push elyby/emails-renderer:$DOCKER_TAG