This commit is contained in:
千里走单骑 2024-04-03 00:42:23 +08:00
parent 89d11f75d4
commit 22fbad3dd3
1 changed files with 64 additions and 68 deletions

View File

@ -3,11 +3,11 @@ run-name: ${{ github.actor }} Gitea Actions 🚀🚀🚀
on: on:
push: push:
# Sequence of patterns matched against refs/heads # Sequence of patterns matched against refs/heads
# branches: branches:
# - main - main
# Sequence of patterns matched against refs/tags # Sequence of patterns matched against refs/tags
tags: tags:
- v* - v*
env: env:
# DOCKER_REGISTRY: docker.io # DOCKER_REGISTRY: docker.io
@ -23,67 +23,67 @@ jobs:
container: container:
image: ghcr.m.daocloud.io/catthehacker/ubuntu:act-latest image: ghcr.m.daocloud.io/catthehacker/ubuntu:act-latest
steps: steps:
# - name: 环境检测 # - name: 环境检测
# run: | # run: |
# which node # which node
# node --version # node --version
# which npm # which npm
# npm --version # npm --version
# which docker # which docker
# docker info # docker info
# echo ${{ github.token }} # echo ${{ github.token }}
# echo ${{ env.GITOPS_URL }} # echo ${{ env.GITOPS_URL }}
- name: 拉取代码 - name: 拉取代码
uses: https://${{ env.DOMAIN }}/actions/checkout@v4 uses: https://${{ env.DOMAIN }}/actions/checkout@v4
# Docker配置多平台环境 # Docker配置多平台环境
# - name: Docker配置多平台环境 # - name: Docker配置多平台环境
# uses: https://${{ env.DOMAIN }}/actions/setup-buildx-action@v3 # uses: https://${{ env.DOMAIN }}/actions/setup-buildx-action@v3
# - name: 获取当前时间 # - name: 获取当前时间
# id: date # id: date
# run: echo "::set-output name=date::$(date +'%Y%m%d%H%M%S')" # run: echo "::set-output name=date::$(date +'%Y%m%d%H%M%S')"
# - name: 构建 & 推送镜像 # - name: 构建 & 推送镜像
# uses: https://${{ env.DOMAIN }}/actions/docker-build-push@v6 # uses: https://${{ env.DOMAIN }}/actions/docker-build-push@v6
# with: # with:
# image: ${{ gitea.repository }} # image: ${{ gitea.repository }}
# tags: ${{ github.sha }} # tags: ${{ github.sha }}
# registry: softyouling-docker.pkg.coding.net # registry: softyouling-docker.pkg.coding.net
# enableBuildKit: true # enableBuildKit: true
# # multiPlatform: true # # multiPlatform: true
# # platform: linux/amd64,linux/arm64,linux/arm/v7 # # platform: linux/amd64,linux/arm64,linux/arm/v7
# dockerfile: Dockerfile # dockerfile: Dockerfile
# username: ${{ secrets.DOCKER_USERNAME }} # username: ${{ secrets.DOCKER_USERNAME }}
# password: ${{ secrets.DOCKER_PASSWORD }} # password: ${{ secrets.DOCKER_PASSWORD }}
- name: 🐬镜像构建推送 - name: 🐬镜像构建推送
uses: https://${{ env.DOMAIN }}/actions/docker-build-push@main uses: https://${{ env.DOMAIN }}/actions/docker-build-push@main
with: with:
image: ${{ gitea.repository }} image: ${{ gitea.repository }}
tags: ${{ gitea.sha }} tags: ${{ gitea.sha }}
registry: ${{ env.DOMAIN }} registry: ${{ env.DOMAIN }}
# enableBuildKit: true # enableBuildKit: true
provenance: false provenance: false
dockerfile: Dockerfile dockerfile: Dockerfile
username: ${{ secrets.DOCKER_USERNAME }} username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }} password: ${{ secrets.DOCKER_PASSWORD }}
gtiops: gtiops:
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: ${{ success() }} if: ${{ success() }}
needs: [build] needs: [build]
steps: steps:
- name: 🐬更新应用镜像 - name: 🐬更新应用镜像
uses: http://gitea.lntu.edu.cn/actions/gitops@main uses: http://gitea.lntu.edu.cn/actions/gitops@main
with: with:
email: "gitops@lntu.edu.cn" email: "gitops@lntu.edu.cn"
name: "千里走单骑" name: "千里走单骑"
value: ${{ gitea.repository }} value: ${{ gitea.repository }}
tag: ${{ github.sha }} tag: ${{ github.sha }}
url: ${{ env.DOMAIN }}/${{ secrets.GITOPS_REPO}} url: ${{ env.DOMAIN }}/${{ secrets.GITOPS_REPO}}
filename: ${{ secrets.FILE_NAME }} filename: ${{ secrets.FILE_NAME }}
token: ${{ secrets.GITOPS_TOKEN }} token: ${{ secrets.GITOPS_TOKEN }}
微信通知: 微信通知:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -91,17 +91,13 @@ jobs:
needs: [build, gtiops] needs: [build, gtiops]
steps: steps:
# 发送通知 # 发送通知
- name: 微信通知 - name: 微信通知
uses: uses: https://${{ env.DOMAIN }}/actions/action-wechat-work@master
https://${{ env.DOMAIN }}/actions/action-wechat-work@master # 若没有配置机器人WebHook则跳过
# 若没有配置机器人WebHook则跳过 if: ${{ secrets.WECHAT_WORK_BOT_WEBHOOK != '' }}
if: ${{ secrets.WECHAT_WORK_BOT_WEBHOOK != '' }} env:
env: WECHAT_WORK_BOT_WEBHOOK: ${{ secrets.WECHAT_WORK_BOT_WEBHOOK }}
WECHAT_WORK_BOT_WEBHOOK: ${{ secrets.WECHAT_WORK_BOT_WEBHOOK }} with:
with: msgtype: markdown
msgtype: markdown content: "✅ 应用版本更新成功\n > 🐬 镜像:\n > softyouling-docker.pkg.coding.net/code/demo/demo:${{ github.sha }}\n > 🍏 就能帮你到这了"
content: "✅ 应用版本更新成功\n
> 🐬 镜像:\n
> softyouling-docker.pkg.coding.net/code/demo/demo:${{ github.sha }}\n
> 🍏 就能帮你到这了"