Skip to content
This repository has been archived by the owner on Nov 21, 2020. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
…into develop
  • Loading branch information
batamar committed Aug 31, 2020
2 parents 89c7534 + 15c1e95 commit f09e17f
Show file tree
Hide file tree
Showing 3 changed files with 98 additions and 40 deletions.
47 changes: 8 additions & 39 deletions .github/workflows/integrations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ on:
paths:
- "**"
- "!**.md"
tags:
- "*"
pull_request:
branches:
- master
Expand All @@ -21,40 +19,35 @@ jobs:
integrations:
runs-on: ubuntu-18.04

# name: Node ${{ matrix.node-version }}

services:
mongodb:
image: mongo:3.6
ports:
- 27017:27017

steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2

- name: Use Node.js 12.16.x
- name: Use Node.js 12.18.x
uses: actions/setup-node@v1
with:
node-version: 12.16.x
node-version: 12.18.x

# https://github.com/actions/cache/blob/master/examples.md#node---yarn
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- name: Cache Node.js modules
- uses: actions/cache@v2
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
uses: actions/cache@v1
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-integrations-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-integrations-${{ hashFiles('yarn.lock') }}
${{ runner.os }}-yarn-integrations-
${{ runner.os }}-yarn-
- name: Install
- name: Install dependencies
run: |
yarn install
Expand All @@ -74,39 +67,15 @@ jobs:
MAIN_APP_DOMAIN: http://localhost:3400

- name: Build
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'push' && ( github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop' )
if: github.event_name == 'push' && ( github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop' )
run: |
rm -rf node_modules
yarn install --production
yarn build
- name: Prepare release assets [tag]
if: startsWith(github.ref, 'refs/tags/')
run: |
tar -zcf erxes-integrations-${GITHUB_REF#refs/tags/}.tar.gz dist node_modules package.json
- name: Get release version [tag]
id: get_release_version
if: startsWith(github.ref, 'refs/tags/')
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/}

- name: Upload release assets [tag]
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: ./erxes-integrations-${{ steps.get_release_version.outputs.VERSION }}.tar.gz
name: Release ${{ steps.get_release_version.outputs.VERSION }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Build docker image [push]
- name: Build docker image
if: github.event_name == 'push' && ( github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop' )
run: |
echo ${{ secrets.DOCKERHUB_TOKEN }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
docker build -t erxes/erxes-integrations:${GITHUB_REF#refs/heads/} -f Dockerfile .
docker push erxes/erxes-integrations:${GITHUB_REF#refs/heads/}
- name: Build docker image [tag]
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
run: |
echo ${{ secrets.DOCKERHUB_TOKEN }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
docker build -t erxes/erxes-integrations:${GITHUB_REF#refs/tags/} -f Dockerfile .
docker push erxes/erxes-integrations:${GITHUB_REF#refs/tags/}
89 changes: 89 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Publish Release

on:
push:
tags:
- '*'

jobs:
release:
runs-on: ubuntu-18.04

services:
mongodb:
image: mongo:3.6
ports:
- 27017:27017

steps:
- uses: actions/checkout@v2

- name: Use Node.js 12.18.x
uses: actions/setup-node@v1
with:
node-version: 12.18.x

- name: Get release version
id: get_release_version
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/}

# https://github.com/actions/cache/blob/master/examples.md#node---yarn
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- uses: actions/cache@v2
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Integrations - Install dependencies
run: |
yarn install
- name: Integrations - Lint
run: |
yarn lint
- name: Integrations - Test
run: |
yarn test
env:
TEST_MONGO_URL: mongodb://localhost/test
GOOGLE_CLIENT_ID: GOOGLE_CLIENT_ID
GOOGLE_CLIENT_SECRET: GOOGLE_CLIENT_SECRET
ENCRYPTION_KEY: aksljdklwjdaklsjdkwljaslkdjwkljd
DOMAIN: http://localhost:3400
MAIN_APP_DOMAIN: http://localhost:3400

- name: Integrations - Build
run: |
rm -rf node_modules
yarn install --production
yarn build
- name: Integrations - Build docker image
run: |
echo ${{ secrets.DOCKERHUB_TOKEN }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
docker build -t erxes/erxes-integrations:${GITHUB_REF#refs/tags/} -f Dockerfile .
docker push erxes/erxes-integrations:${GITHUB_REF#refs/tags/}
- name: Prepare release assets
run: |
mkdir -p integrations
mv dist integrations/dist
mv node_modules integrations/node_modules
mv package.json integrations/package.json
tar -zcf erxes-integrations-${GITHUB_REF#refs/tags/}.tar.gz integrations/dist integrations/node_modules integrations/package.json
- name: Upload release assets
uses: softprops/action-gh-release@v1
with:
files: |
erxes-integrations-${{ steps.get_release_version.outputs.VERSION }}.tar.gz
name: Release ${{ steps.get_release_version.outputs.VERSION }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:12.16-slim
FROM node:12.18-slim
WORKDIR /erxes-integrations
RUN chown -R node:node /erxes-integrations
COPY --chown=node:node . /erxes-integrations
Expand Down

0 comments on commit f09e17f

Please sign in to comment.