Skip to content

add google api proxy #12

add google api proxy

add google api proxy #12

Workflow file for this run

name: main-build-deploy
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Repositories
uses: actions/checkout@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Setup NodeJS
uses: actions/setup-node@v1
with:
node-version: 16.10.0
- name: NPM install
run: |
npm i
- name: Build
run: npm run build
- name: Set short sha
id: vars
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Build, tag, and push image to Amazon ECR
id: build-image
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: my-ecr-repo
IMAGE_TAG: ${{ steps.vars.outputs.sha_short }}
run: |
npm run docker-ci
- name: Deploy the proxy
uses: garygrossgarten/github-action-ssh@release
with:
command: |
sed -i -r 's/openai-proxy:[0-9a-z]{7}/openai-proxy:${{ steps.vars.outputs.sha_short }}/g' /root/docker-compose.yml
$(aws ecr get-login --no-include-email --region cn-northwest-1)
docker-compose up -d
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
privateKey: ${{ secrets.PRIVATE_KEY}}
outputs:
version: ${{ github.sha }}