Skip to content

fix: Add additional topics to use successTextRespondStrategy #14

fix: Add additional topics to use successTextRespondStrategy

fix: Add additional topics to use successTextRespondStrategy #14

Workflow file for this run

name: Push
on:
workflow_dispatch: {}
push:
branches:
- main
env:
GO_VERSION: 1.20.10
jobs:
prepare:
runs-on: ubuntu-latest
outputs:
BUILD_TIME: ${{ steps.buildinfo.outputs.BUILD_TIME }}
BUILD_VERSION: ${{ steps.buildinfo.outputs.BUILD_VERSION }}
BUILD_REVISION: ${{ steps.buildinfo.outputs.BUILD_REVISION }}
steps:
- name: checkout
uses: actions/checkout@v2
- name: calculate build version
id: buildinfo
run: |
SHORT_SHA=${GITHUB_SHA::8}
VERSION=${GITHUB_REF_NAME}
echo "BUILD_TIME=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT
echo "BUILD_VERSION=${VERSION}" >> $GITHUB_OUTPUT
echo "BUILD_REVISION=${SHORT_SHA}" >> $GITHUB_OUTPUT
test:
runs-on: ubuntu-latest
needs:
- prepare
steps:
- name: checkout
uses: actions/checkout@v2
- name: setup go
uses: actions/setup-go@v2
with:
go-version: ${{ env.GO_VERSION }}
- name: setup cache
uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore_keys: |
${{ runner.os }}-go-
- name: install dependencies
run: |
go mod download
- name: run tests
run: |
go test -v ./...
build:
runs-on: ubuntu-latest
needs:
- prepare
- test
steps:
- name: checkout
uses: actions/checkout@v2
- name: setup buildx
uses: docker/setup-buildx-action@v2
with:
platforms: linux/amd64
- name: login to ghcr
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ secrets.GHCR_USERNAME }}
password: ${{ secrets.GHCR_PASSWORD }}
- name: login to aliyuncr
uses: docker/login-action@v2
with:
registry: registry.cn-hangzhou.aliyuncs.com
username: ${{ secrets.ALIYUNCR_USERNAME }}
password: ${{ secrets.ALIYUNCR_PASSWORD }}
- name: build
uses: docker/build-push-action@v3
with:
push: true
platforms: linux/amd64
build-args: |
BUILD_TIME=${{ needs.prepare.outputs.BUILD_TIME }}
BUILD_VERSION=${{ needs.prepare.outputs.BUILD_VERSION }}
BUILD_REVISION=${{ needs.prepare.outputs.BUILD_REVISION }}
tags: |
ghcr.io/imulab/wetriage:latest
ghcr.io/imulab/wetriage:${{ needs.prepare.outputs.BUILD_VERSION }}
ghcr.io/imulab/wetriage:${{ needs.prepare.outputs.BUILD_REVISION }}
registry.cn-hangzhou.aliyuncs.com/elan-vision/wetriage:latest
registry.cn-hangzhou.aliyuncs.com/elan-vision/wetriage:${{ needs.prepare.outputs.BUILD_VERSION }}
registry.cn-hangzhou.aliyuncs.com/elan-vision/wetriage:${{ needs.prepare.outputs.BUILD_REVISION }}
labels: |
org.opencontainers.image.title="WeTriage"
org.opencontainers.image.source="https://github.com/imulab/WeTriage"
org.opencontainers.image.authors="Weinan Qiu"