Skip to content

Merge pull request #2 from gruppin/fix-tel-aviv-trees #10

Merge pull request #2 from gruppin/fix-tel-aviv-trees

Merge pull request #2 from gruppin/fix-tel-aviv-trees #10

Workflow file for this run

name: Client CI
env:
IMAGE: ghcr.io/hasadna/meirim/meirim-client
permissions:
contents: read
packages: write
on:
push:
paths:
- client/**
- .github/workflows/client.yml
jobs:
# test:
# runs-on: ubuntu-latest
# services:
# test_mysql:
# image: mysql:5.7
# env:
# MYSQL_ROOT_PASSWORD: password
# ports:
# - 33060:3306
#
# steps:
# - uses: actions/checkout@v2
#
# - name: use node v14.x
# uses: actions/setup-node@v1
# with:
# node-version: 14.x
#
# - name: cache node modules
# uses: actions/cache@v2
# with:
# path: |
# ~/.cache
# !~/.cache/exclude
# **/node_modules
# key: ${{ runner.OS }}-build-${{ hashFiles('**/package-lock.json') }}
# restore-keys: ${{ runner.OS }}-build-${{ env.cache-name }}
# ${{ runner.OS }}-build-
# ${{ runner.OS }}-
#
# - name: install server dependencies
# working-directory: server
# run: npm install
#
# - name: create database
# run: mysql --protocol=tcp --host=localhost --port=33060 --user=root --password=password -e "CREATE DATABASE test_meirim character set UTF8 collate utf8_bin; SET GLOBAL sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY,',''));"
#
# - name: run migrations
# env:
# NODE_CONFIG: '{"database": {"connection": {"host": "localhost", "port": "33060", "user": "root", "password": "password", "database": "test_meirim"}}}'
# working-directory: server
# run: node node_modules/knex/bin/cli.js migrate:latest
#
# - name: install client dependencies
# working-directory: client
# run: npm install
#
# - name: build frontend
# working-directory: client
# run: npm run build
#
# - name: get ethereal credentials
# id: get_ethereal_credentials
# run: |
# response=$(curl -XPOST -d "{\"requestor\": \"meirim-test\", \"version\": \"0.0.1\"}" -H "Content-Type: application/json" https://api.nodemailer.com/user)
# echo "::set-output name=user::$(echo $response | jq -r '.user')"
# echo "::set-output name=pass::$(echo $response | jq -r '.pass')"
#
# - name: serve
# env:
# NODE_CONFIG: '{"database": {"connection": {"host": "localhost", "port": "33060", "user": "root", "password": "password", "database": "test_meirim"}}, "email": {"templates": {"digestPlans": "d-db0b55ab042e4ba9878715acd35c1d6c"}, "options": {"host": "smtp.ethereal.email", "port": 587, "secure": false, "auth": {"user": "${{ steps.get_ethereal_credentials.outputs.user }}", "pass": "${{ steps.get_ethereal_credentials.outputs.pass }}"}}}}'
# working-directory: server
# run: |
# npm run serve &
# sleep 3
#
# - name: e2e test
# working-directory: client
# run: |
# $(npm bin)/cypress run --browser chrome --headless &&
# $(npm bin)/cypress run --browser firefox --headless
# build-and-deploy-staging:
# environment: staging
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2
#
# - name: use node v14.x
# uses: actions/setup-node@v1
# with:
# node-version: 14.x
#
# - name: install client dependencies
# working-directory: client
# run: npm install
#
# - name: create version.txt
# working-directory: client
# run: echo "https://github.com/meirim-org/meirim/commit/${{ github.sha }}" > public/version.txt
#
# - name: build
# working-directory: client
# run: npm run build
# env:
# NODE_ENV: staging
# BASE_NAME: ${{ github.ref_name }}
# PUBLIC_URL: "https://staging.meirim.org/${{ github.ref_name }}"
# REACT_APP_BASE_API_URL: https://staging-api.meirim.org/api
#
# - uses: jakejarvis/s3-sync-action@master
# with:
# args: --acl public-read --follow-symlinks --delete --cache-control max-age=3600
# env:
# AWS_S3_BUCKET: staging.meirim.org
# AWS_ACCESS_KEY_ID: ${{ secrets.AWS_CI_ACCESS_KEY }}
# AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_CI_SECRET_KEY }}
# SOURCE_DIR: "client/build"
# DEST_DIR: ${{ github.ref_name }}
# AWS_REGION: il-central-1
# - name: info
# run: |
# echo "deployed to"
# echo "https://staging.meirim.org/${{ github.ref_name }}"
build-and-deploy-prod:
# environment: prod
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: use node v14.x
uses: actions/setup-node@v1
with:
node-version: 14.x
- name: install client dependencies
working-directory: client
run: npm install
- name: create version.txt
working-directory: client
run: echo "https://github.com/meirim-org/meirim/commit/${{ github.sha }}" > public/version.txt
- name: build
working-directory: client
run: npm run build
env:
PUBLIC_URL: "https://meirim.org"
NODE_ENV: production
REACT_APP_BASE_API_URL: https://api.meirim.org/api
- uses: actions/upload-artifact@v4
with:
name: client-build
path: client/build
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/setup-buildx-action@v3
- id: docker_build
uses: docker/build-push-action@v6
with:
push: true
tags: ${{ env.IMAGE }}:${{ github.sha }}
context: client
# - uses: jakejarvis/s3-sync-action@master
# with:
# args: --acl public-read --follow-symlinks --delete --cache-control max-age=3600
# env:
# AWS_S3_BUCKET: prod.meirim.org
# AWS_ACCESS_KEY_ID: ${{ secrets.AWS_CI_ACCESS_KEY }}
# AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_CI_SECRET_KEY }}
# SOURCE_DIR: "client/build"
# AWS_REGION: il-central-1