-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #94 from dcalacci/develop
v0.3
- Loading branch information
Showing
153 changed files
with
1,095 additions
and
890 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
|
||
# Automatic deployment to a staging environment on every push to master. | ||
staging: | ||
auto_deploy_on: refs/heads/master | ||
required_contexts: ["build"] | ||
environment: staging | ||
description: 'Staging' | ||
payload: | ||
release: staging-gigbox | ||
namespace: gigbox-staging | ||
track: stable | ||
values: | | ||
apiHostname: ${{ API_HOSTNAME }} | ||
certEmail: ${{ CERT_EMAIL }} | ||
hostOSRMPath: /home/dcalacci/osrm-data | ||
hostGigboxDataPath: /home/dcalacci/gigbox-data | ||
twilioNumber: ${{TWILIO_NUMBEr}} | ||
twilioSid: ${{TWILIO_SID}} | ||
twilioToken: ${{TWILIO_TOKEN}} | ||
dbHost: ${{DB_HOST}} | ||
dbPort: ${{DB_PORT}} | ||
postgresUser: gigbox | ||
postgresPassword: ${{POSTGRES_PASSWORD}} | ||
postgresDbName: gigbox-staging | ||
secretKey: ${{SECRET_KEY}} | ||
imageTag: develop | ||
env: PRODUCTION |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,246 @@ | ||
name: 'CI/CD' | ||
on: | ||
push: | ||
pull_request: | ||
branches: | ||
- master | ||
- develop | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build-prod-server: | ||
name: Build Prod Server | ||
if: github.ref == 'refs/heads/master' && github.event_name == 'push' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- | ||
name: Checkout | ||
uses: actions/checkout@master | ||
- | ||
name: Set up QEMU | ||
uses: docker/setup-qemu-action@v1 | ||
- | ||
name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
- | ||
name: Login to DockerHub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- | ||
name: Build and push | ||
id: docker_build | ||
uses: docker/build-push-action@v2 | ||
with: | ||
push: true | ||
context: ./server | ||
file: ./server/Dockerfile | ||
tags: gigbox/gigbox-server:latest | ||
- | ||
name: Image digest | ||
run: echo ${{ steps.docker_build.outputs.digest }} | ||
build-branch-server: | ||
name: Build Branch Server | ||
if: github.event_name == 'push' && github.ref != 'refs/heads/master' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- | ||
name: Checkout | ||
uses: actions/checkout@master | ||
- | ||
name: Set up QEMU | ||
uses: docker/setup-qemu-action@v1 | ||
- | ||
name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
- | ||
name: Login to DockerHub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- name: Set env.BRANCH | ||
run: echo "BRANCH=$(echo $GITHUB_REF | cut -d'/' -f 3)" >> $GITHUB_ENV | ||
- | ||
name: Build and push | ||
id: docker_build | ||
uses: docker/build-push-action@v2 | ||
with: | ||
push: true | ||
context: ./server | ||
file: ./server/Dockerfile | ||
tags: gigbox/gigbox-server:${{ env.BRANCH }} | ||
- | ||
name: Image digest | ||
run: echo ${{ steps.docker_build.outputs.digest }} | ||
build-review-server: | ||
name: Build PR Review Server | ||
if: github.event_name == 'pull_request' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- | ||
name: Checkout | ||
uses: actions/checkout@master | ||
- | ||
name: Set up QEMU | ||
uses: docker/setup-qemu-action@v1 | ||
- | ||
name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
- | ||
name: Login to DockerHub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- name: Set env.BRANCH | ||
run: echo "BRANCH=$(echo $GITHUB_REF | cut -d'/' -f 3)" >> $GITHUB_ENV | ||
- | ||
name: Build and push | ||
id: docker_build | ||
uses: docker/build-push-action@v2 | ||
with: | ||
push: true | ||
context: ./server | ||
file: ./server/Dockerfile | ||
tags: gigbox/gigbox-server:pr-${{github.event.number}} | ||
- | ||
name: Image digest | ||
run: echo ${{ steps.docker_build.outputs.digest }} | ||
lint-helm: | ||
name: Lint Helm Chart | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Lint Helm | ||
uses: WyriHaximus/github-action-helm3@v2 | ||
with: | ||
exec: helm lint ./server/chart/gigbox-chart | ||
deploy-review-server: | ||
runs-on: 'ubuntu-latest' | ||
if: github.event_name == 'pull_request' | ||
needs: | ||
- lint-helm | ||
- build-review-server | ||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Prep helm chart | ||
run: | | ||
mv ./server/chart/gigbox-chart/Chart.yaml ./server/chart/gigbox-chart/Chart.old.yaml && | ||
cat ./server/chart/gigbox-chart/Chart.old.yaml | grep -v appVersion > ./server/chart/gigbox-chart/Chart.yaml && | ||
echo -e "\r\nappVersion: v${GITHUB_REF##*/}\r\n" >> ./server/chart/gigbox-chart/Chart.yaml && | ||
cat ./server/chart/gigbox-chart/Chart.yaml | ||
- uses: timheuer/base64-to-file@v1.1 | ||
id: write_values | ||
name: Decrypt values to file | ||
with: | ||
fileName: 'values.yaml' | ||
fileDir: './server/' | ||
encodedString: ${{ secrets.HELM_VALUES }} | ||
- name: Deploy | ||
uses: WyriHaximus/github-action-helm3@v2 | ||
with: | ||
exec: helm upgrade --install --force pr-${{ github.event.number}}-gigbox ./server/chart/gigbox-chart --wait --atomic -n pr-${{github.event.number}} --create-namespace --values ${{ steps.write_values.outputs.filePath }} --set apiHostname=pr-${{github.event.number}}.gigbox.app | ||
kubeconfig: '${{ secrets.KUBECONFIG }}' | ||
- uses: unsplash/comment-on-pr@master | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
msg: Server deployed and cert is being provisioned at [https://pr-${{github.event.number}}.gigbox.app](https://pr-${{github.event.number}}.gigbox.app) | ||
deploy-branch-server: | ||
runs-on: 'ubuntu-latest' | ||
if: github.event_name == 'push' | ||
needs: | ||
- lint-helm | ||
- build-branch-server | ||
|
||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Prep helm chart | ||
run: | | ||
mv ./server/chart/gigbox-chart/Chart.yaml ./server/chart/gigbox-chart/Chart.old.yaml && | ||
cat ./server/chart/gigbox-chart/Chart.old.yaml | grep -v appVersion > ./server/chart/gigbox-chart/Chart.yaml && | ||
echo -e "\r\nappVersion: v${GITHUB_REF##*/}\r\n" >> ./server/chart/gigbox-chart/Chart.yaml && | ||
cat ./server/chart/gigbox-chart/Chart.yaml | ||
- uses: timheuer/base64-to-file@v1.1 | ||
id: write_values | ||
name: Decrypt values to file | ||
with: | ||
fileName: 'values.yaml' | ||
fileDir: './server/' | ||
encodedString: ${{ secrets.HELM_VALUES }} | ||
- name: Set env.BRANCH | ||
run: echo "BRANCH=$(echo $GITHUB_REF | cut -d'/' -f 3)" >> $GITHUB_ENV | ||
- name: Deploy | ||
uses: WyriHaximus/github-action-helm3@v2 | ||
with: | ||
exec: helm upgrade --install --force ${{ env.BRANCH}} ./server/chart/gigbox-chart --wait --atomic -n ${{ env.BRANCH }}-branch --create-namespace --values ${{ steps.write_values.outputs.filePath }} --set apiHostname=${{ env.BRANCH }}.gigbox.app | ||
kubeconfig: '${{ secrets.KUBECONFIG }}' | ||
build-review-app: | ||
name: Build and publish expo review app | ||
if: github.event_name == 'pull_request' | ||
needs: | ||
- deploy-review-server | ||
runs-on: ubuntu-latest | ||
env: | ||
DEV_API_URL: https://pr-${{github.event.number}}.gigbox.app | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v1 | ||
with: | ||
node-version: 14.x | ||
- uses: expo/expo-github-action@v5 | ||
with: | ||
expo-version: 4.x | ||
expo-token: ${{ secrets.EXPO_TOKEN }} | ||
- name: Check API URL | ||
run: echo ${{ env.DEV_API_URL }} | ||
- run: cd app && yarn install | ||
- run: cd app && expo publish --release-channel=pr-${{ github.event.number }} | ||
- uses: unsplash/comment-on-pr@master | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
msg: App is ready for review, you can [see it here](https://expo.io/@dcalacci/gigbox?release-channel=pr-${{ github.event.number }}). | ||
build-branch-app: | ||
name: Build and publish latest branch expo app | ||
if: github.event_name == 'push' | ||
needs: | ||
- deploy-branch-server | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set env.BRANCH | ||
run: echo "BRANCH=$(echo $GITHUB_REF | cut -d'/' -f 3)" >> $GITHUB_ENV | ||
- name: Set env.DEV_API_URL | ||
run: echo "DEV_API_URL=https://$(echo $GITHUB_REF | cut -d'/' -f 3).gigbox.app" >> $GITHUB_ENV | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v1 | ||
with: | ||
node-version: 14.x | ||
- name: Check API URL | ||
run: echo ${{ env.DEV_API_URL }} | ||
- uses: expo/expo-github-action@v5 | ||
with: | ||
expo-version: 4.x | ||
expo-token: ${{ secrets.EXPO_TOKEN }} | ||
- run: cd app && yarn install | ||
- run: cd app && expo publish --release-channel=rc-${{ env.BRANCH }} | ||
build-prod-app: | ||
name: Publish App to Staging Release Channel | ||
runs-on: ubuntu-latest | ||
needs: [build-prod-server] | ||
if: github.ref == 'refs/heads/master' && github.event_name == 'push' | ||
env: | ||
DEV_API_URL: ${{ secrets.DEV_API_URL }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v1 | ||
with: | ||
node-version: 14.x | ||
- uses: expo/expo-github-action@v5 | ||
with: | ||
expo-version: 4.x | ||
expo-token: ${{ secrets.EXPO_TOKEN }} | ||
- run: cd app && yarn install | ||
- run: cd app && expo publish --release-channel=staging |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.