-
Notifications
You must be signed in to change notification settings - Fork 0
57 lines (48 loc) · 1.51 KB
/
publish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
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 }}