Skip to content
This repository has been archived by the owner on Apr 22, 2024. It is now read-only.

Docker wxweb Build

Docker wxweb Build #47

name: Docker wxweb Build
on:
workflow_dispatch:
watch:
types: [started]
jobs:
md:
name: Docker md Build
runs-on: ubuntu-latest
steps:
-
name: Private Actions Checkout
uses: actions/[email protected]
-
name: Docker Setup QEMU
uses: docker/[email protected]
-
name: Docker Setup Buildx
uses: docker/[email protected]
-
name: Docker Login
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Log in to the Container registry
uses: docker/[email protected]
with:
registry: ghcr.io
username: xrsec
password: ${{ secrets.TOKEN_GITHUB }}
# -
# name: Wget zip
# run: |
# curl -sLm 10 -o md.tar.gz $(jq -r .tarball_url <(curl -sLm 10 https://api.github.com/repos/doocs/md/releases/latest -H "Authorization: token ${{ SECRETS.TOKEN_GITHUB }}"))
-
name: Build and push Docker images
uses: docker/[email protected]
with:
context: .
file: Dockerfiles/md
platforms: linux/amd64,linux/arm64
push: true
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/wxweb:md
${{ secrets.DOCKERHUB_USERNAME }}/wxweb:latest
ghcr.io/${{ secrets.DOCKERHUB_USERNAME }}/wxweb:md
ghcr.io/${{ secrets.DOCKERHUB_USERNAME }}/wxweb:latest
cache-from: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/wxweb:md.cache
cache-to: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/wxweb:md.cache,mode=max
online-markdown:
name: Docker online-markdown Build
runs-on: ubuntu-latest
steps:
-
name: Private Actions Checkout
uses: actions/[email protected]
-
name: Docker Setup QEMU
uses: docker/[email protected]
-
name: Docker Setup Buildx
uses: docker/[email protected]
-
name: Docker Login
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Log in to the Container registry
uses: docker/[email protected]
with:
registry: ghcr.io
username: xrsec
password: ${{ secrets.TOKEN_GITHUB }}
-
name: Build and push Docker images
uses: docker/[email protected]
with:
context: .
file: Dockerfiles/online-markdown
platforms: linux/amd64,linux/arm64
push: true
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/wxweb:online-markdown
ghcr.io/${{ secrets.DOCKERHUB_USERNAME }}/wxweb:online-markdown
cache-from: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/wxweb:online-markdown.cache
cache-to: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/wxweb:online-markdown.cache,mode=max
Repository_Dispatch:
needs: [md,online-markdown]
runs-on: ubuntu-latest
steps:
-
name: Private Actions Checkout
uses: actions/[email protected]
-
name: Docker Hub Description
uses: peter-evans/dockerhub-description@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
repository: ${{ secrets.DOCKERHUB_USERNAME }}/wxweb
-
name: Get Data
id: getDingData
run: |
set -ex
# 输出仓库名
REPOSITORY="${{GITHUB.REPOSITORY}}"
echo "REPOSITORY=${REPOSITORY#*/}" >> $GITHUB_OUTPUT
# 获取用户仓库信息
# RESPONSE="$(curl -sLm 10 https://api.github.com/repos/${{ GITHUB.REPOSITORY }})"
# 建议填写自己的 TOKEN
RESPONSE="$(curl -sLm 10 https://api.github.com/repos/${{ GITHUB.REPOSITORY }} -H "Authorization: token ${{ SECRETS.TOKEN_GITHUB }}")"
# 获取 用户仓库 设置的 描述,如果为空,可能是没有使用 TOKEN
DESCRIPTION="$(jq -r .description <(echo ${RESPONSE}))"
echo "DESCRIPTION=${DESCRIPTION}" >> $GITHUB_OUTPUT
# 获取 用户仓库 设置的 URL, 如果没有就输出 Github 地址
URL="$(jq -r .homepage <(echo ${RESPONSE}))"
if [[ "${URL}" == "null" || "${URL}" == "" ]]; then
echo "URL=${{ GITHUB.SERVER_URL }}/${{ GITHUB.REPOSITORY }}" >> $GITHUB_OUTPUT
else
echo "URL=${URL}" >> $GITHUB_OUTPUT
fi
-
name: Send dingding notify
uses: zcong1993/actions-ding@master
with:
dingToken: ${{ SECRETS.DING_TOKEN }}
secret: ${{ SECRETS.DING_SECRET }}
body: |
{
"msgtype": "link",
"link": {
"text": "${{ steps.getDingData.outputs.DESCRIPTION }}",
"title": "${{ steps.getDingData.outputs.REPOSITORY }} WorkFlow ${{ GITHUB.JOB }} Success!",
"picUrl": "https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png",
"messageUrl": "${{ steps.getDingData.outputs.URL }}"
}
}
-
name: webhook
run: |
curl -s ${{ SECRETS.WebHock }}