diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..93e508f --- /dev/null +++ b/.github/workflows/ci.yml @@ -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 diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index c5d668c..0000000 --- a/.travis.yml +++ /dev/null @@ -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