Release v1.4.4 #28
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 构建最新的容器镜像 - 推送到 Docker Hub - 推送到腾讯云仓库 - 服务器部署最新版本的镜像 | |
# 参数说明: | |
# - secrets.DOCKER_HUB_USERNAME Docker Hub 用户名 | |
# - secrets.DOCKER_HUB_PASSWORD Docker Hub 密码 | |
# - secrets.TENCENT_CLOUD_REGISTRY_USERNAME 腾讯云仓库用户名 | |
# - secrets.TENCENT_CLOUD_REGISTRY_PASSWORD 腾讯云仓库用户名 | |
# - secrets.SERVER_PRIVATE_KEY 登入服务器密钥 | |
# - secrets.SERVER_HOST 服务器地址 | |
# - secrets.SERVER_USERNAME 服务器用户 | |
name: Build and deploy | |
on: | |
release: | |
types: | |
- published | |
env: | |
DOCKER_HUB_REPOSITORY: studiomj/jump-jump | |
TENCENT_CLOUD_REGISTRY: hkccr.ccs.tencentyun.com | |
TENCENT_CLOUD_REPOSITORY: hkccr.ccs.tencentyun.com/anmuji/jump-jump | |
jobs: | |
docker-hub: | |
name: Build and push image to Docker Hub | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check the release code | |
uses: actions/checkout@v2 | |
- name: Build and push docker image | |
uses: docker/build-push-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_PASSWORD }} | |
repository: ${{ env.DOCKER_HUB_REPOSITORY }} | |
tags: latest | |
tag_with_ref: true | |
dockerfile: ./build/package/Dockerfile | |
deploy: | |
name: Deploy | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check the release code | |
uses: actions/checkout@v2 | |
- name: Get tag | |
id: tag | |
uses: dawidd6/action-get-tag@v1 | |
- name: Build docker image | |
run: | | |
docker build \ | |
-t $TENCENT_CLOUD_REPOSITORY:latest \ | |
-t $TENCENT_CLOUD_REPOSITORY:${{ steps.tag.outputs.tag }} \ | |
-f build/package/Dockerfile . | |
- name: Push docker image to tencent cloud registry | |
run: | | |
docker login \ | |
--username=${{ secrets.TENCENT_CLOUD_REGISTRY_USERNAME }} \ | |
--password=${{ secrets.TENCENT_CLOUD_REGISTRY_PASSWORD }} \ | |
$TENCENT_CLOUD_REGISTRY | |
docker push $TENCENT_CLOUD_REPOSITORY:latest | |
docker push $TENCENT_CLOUD_REPOSITORY:${{ steps.tag.outputs.tag }} | |
docker logout | |
- uses: webfactory/ssh-agent@v0.5.3 | |
with: | |
ssh-private-key: ${{ secrets.SERVER_PRIVATE_KEY }} | |
- name: Run deploy script | |
env: | |
HOST: ${{ secrets.SERVER_HOST }} | |
USERNAME: ${{ secrets.SERVER_USERNAME }} | |
run: ssh -o StrictHostKeyChecking=no -tt $USERNAME@$HOST "./deploy/deploy-jump-jump.sh" |