👷 update ci

This commit is contained in:
yanyongyu_1 2021-06-16 15:37:33 +08:00 committed by yanyongyu
parent bd4efc1533
commit a27e7d1702
2 changed files with 64 additions and 1 deletions

63
.github/workflows/docker_release.yml vendored Normal file
View File

@ -0,0 +1,63 @@
name: Release
on:
push:
tags:
- "v*"
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup poetry
uses: Gr1N/setup-poetry@v4
- name: Setup Docker
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Login to Github Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Get Version
id: version
run: |
echo "::set-output name=VERSION::$(poetry version -s)"
echo "::set-output name=TAG::${GITHUB_REF#refs/tags/v}"
- name: Check Version
if: ${{ steps.version.outputs.VERSION != steps.version.outputs.TAG }}
run: exit 1
- name: Generate Tags
uses: docker/metadata-action@v3
id: metadata
with:
images: |
cscs181/qq-github-bot
ghcr.io/cscs181/qq-github-bot
tags: |
type=semver,pattern={{version}}
type=sha
- name: Build and Publish
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ${{ steps.metadata.outputs.tags }}
labels: ${{ steps.metadata.outputs.labels }}

View File

@ -14,7 +14,7 @@ services:
container_name: bot
# volumes:
# - "/etc/localtime:/etc/localtime"
# - "./:/app/"
# - "./.env:/app/.env.prod" # replace "./.env" with your own config file
ports:
- "$PORT:$PORT"
environment: