Skip to content

update handleSyncChat when no login (#415) #65

update handleSyncChat when no login (#415)

update handleSyncChat when no login (#415) #65

Workflow file for this run

name: Publish
on:
push:
tags:
- "v*"
jobs:
build_api:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: "16.x"
- name: build web
run: |
npm install
npm run build
working-directory: web
- name: copy to api/static
run: |
cp -R web/dist/* api/static/
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.19
- name: Build Chat Binary
run: go build -v ./...
working-directory: api
- name: Test Chat
run: go test -v ./...
working-directory: api
# use root folder docker
- name: Build Chat image
run: |
docker build . --file Dockerfile -t ghcr.io/swuecho/chat:${GITHUB_REF#refs/tags/}
- name: Login to GitHub Container Registry
run: echo "${{ secrets.GHCR_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Push API image to GitHub Container Registry
run: |
docker push ghcr.io/swuecho/chat:${GITHUB_REF#refs/tags/}
docker tag ghcr.io/swuecho/chat:${GITHUB_REF#refs/tags/} ghcr.io/swuecho/chat:latest
docker push ghcr.io/swuecho/chat:latest
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: push to docker
run: |
docker tag ghcr.io/swuecho/chat:${GITHUB_REF#refs/tags/} echowuhao/chat:${GITHUB_REF#refs/tags/}
docker tag ghcr.io/swuecho/chat:${GITHUB_REF#refs/tags/} echowuhao/chat:latest
docker push echowuhao/chat:${GITHUB_REF#refs/tags/}
docker push echowuhao/chat:latest