mirror of
https://github.com/elyby/emails-renderer.git
synced 2024-11-22 21:23:12 +05:30
Replace travis with GitHub actions
This commit is contained in:
parent
6a65e714ff
commit
485493f184
64
.github/workflows/ci.yml
vendored
Normal file
64
.github/workflows/ci.yml
vendored
Normal 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
|
34
.travis.yml
34
.travis.yml
@ -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
|
Loading…
Reference in New Issue
Block a user