demo
This commit is contained in:
commit
81a7dfd5b1
|
@ -0,0 +1,25 @@
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
tags:
|
||||||
|
- v*
|
||||||
|
pull_request:
|
||||||
|
types: [opened, synchronize, reopened]
|
||||||
|
|
||||||
|
name: SonarQube Scan
|
||||||
|
jobs:
|
||||||
|
sonarqube:
|
||||||
|
name: SonarQube Trigger
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checking out
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
# Disabling shallow clone is recommended for improving relevancy of reporting
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: SonarQube Scan
|
||||||
|
uses: kitabisa/sonarqube-action@v1.2.0
|
||||||
|
with:
|
||||||
|
host: ${{ secrets.SONARQUBE_HOST }}
|
||||||
|
login: ${{ secrets.SONARQUBE_TOKEN }}
|
|
@ -0,0 +1,132 @@
|
||||||
|
name: CI
|
||||||
|
run-name: ${{ github.actor }} Gitea Actions 🚀🚀🚀
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
# Sequence of patterns matched against refs/heads
|
||||||
|
# branches:
|
||||||
|
# - main
|
||||||
|
# Sequence of patterns matched against refs/tags
|
||||||
|
tags:
|
||||||
|
- v*
|
||||||
|
|
||||||
|
env:
|
||||||
|
# DOCKER_REGISTRY: docker.io
|
||||||
|
# DOCKER_USERNAME: softyouling
|
||||||
|
# 此处可修改为你任意 docker 镜像仓库地址和用户名
|
||||||
|
DOMAIN: gitea.lntu.edu.cn
|
||||||
|
IMAGE_NAME: ${{ github.repository }}
|
||||||
|
GITOPS_URL: ${{ env.DOMAIN }}/${{ secrets.GITOPS_REPO }}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
# container: catthehacker/ubuntu:act-latest
|
||||||
|
steps:
|
||||||
|
# - name: 环境检测
|
||||||
|
# run: |
|
||||||
|
# which node
|
||||||
|
# node --version
|
||||||
|
# which npm
|
||||||
|
# npm --version
|
||||||
|
# which docker
|
||||||
|
# docker info
|
||||||
|
# echo ${{ github.token }}
|
||||||
|
# echo ${{ env.GITOPS_URL }}
|
||||||
|
|
||||||
|
- name: 拉取代码
|
||||||
|
uses: https://${{ env.DOMAIN }}/actions/checkout@v4
|
||||||
|
|
||||||
|
- name: 安装依赖,构建
|
||||||
|
run: |
|
||||||
|
npm config set registry https://registry.npmmirror.com
|
||||||
|
npm i
|
||||||
|
npm run build
|
||||||
|
|
||||||
|
# Docker配置多平台环境
|
||||||
|
- name: Docker配置多平台环境
|
||||||
|
uses: https://${{ env.DOMAIN }}/actions/setup-buildx-action@v3
|
||||||
|
|
||||||
|
# - name: 修改镜像信息
|
||||||
|
# id: meta
|
||||||
|
# # uses: docker/metadata-action@v4
|
||||||
|
# # GITHUB_OUTPUT 在流水线中传递的变量
|
||||||
|
# run: |
|
||||||
|
# echo REPO_NAME=$(echo ${GITHUB_REPOSITORY} | awk -F"/" '{print $2}') >> $GITHUB_OUTPUT
|
||||||
|
# echo REPO_VERSION=$(echo ${{ github.ref }} | awk -F"/" '{print $3}') >> $GITHUB_OUTPUT
|
||||||
|
# 需要v1.0.0的形式的时候使用
|
||||||
|
|
||||||
|
- name: 构建 & 推送镜像
|
||||||
|
uses: https://${{ env.DOMAIN }}/actions/docker-build-push@v6
|
||||||
|
with:
|
||||||
|
image: ${{ env.IMAGE_NAME }}
|
||||||
|
tags: ${{ github.sha }}
|
||||||
|
registry: ${{ env.DOMAIN }}
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
|
# platforms: |
|
||||||
|
# linux/amd64
|
||||||
|
# linux/arm64
|
||||||
|
# tags: ${{ env.DOMAIN }}/${{env.IMAGE_NAME}}:${{ steps.meta.outputs.REPO_VERSION }}
|
||||||
|
|
||||||
|
gtiops:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: ${{ success() }}
|
||||||
|
needs: [build]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: 🐬更新应用镜像
|
||||||
|
uses: https://${{ env.DOMAIN }}/actions/gitops_actions@main
|
||||||
|
with:
|
||||||
|
gitops-token: ${{ secrets.GITOPS_TOKEN }}
|
||||||
|
gitops-url: ${{ env.GITOPS_URL }}
|
||||||
|
commit-email: "gitops@lntu.edu.cn"
|
||||||
|
commit-name: "千里走单骑"
|
||||||
|
file-name: ${{ secrets.FILE_NAME }}
|
||||||
|
images-value: ${{ env.DOMAIN }}/${{ github.repository }}:${{ github.sha }}
|
||||||
|
image-tag: ${{ github.sha }}
|
||||||
|
|
||||||
|
# - name: 🚀更新应用镜像
|
||||||
|
# run: |
|
||||||
|
# git config --global user.email "gitops@lntu.edu.cn"
|
||||||
|
# git config --global user.name "千里走单骑"
|
||||||
|
# git config --global init.defaultBranch main
|
||||||
|
# mkdir repo
|
||||||
|
# cd repo
|
||||||
|
# git init
|
||||||
|
# git remote add origin https://${{ secrets.GITOPS_TOKEN }}@${{ env.GITOPS_URL }}
|
||||||
|
# git config core.sparsecheckout true
|
||||||
|
# echo ${{ secrets.FILE_NAME }} >> .git/info/sparse-checkout
|
||||||
|
# git pull origin main
|
||||||
|
# ls -l
|
||||||
|
# sed -i "s#${{ env.DOMAIN }}.*#${{ env.DOMAIN }}/${{ env.IMAGE_NAME }}:${{ github.sha }}#g" ${{ secrets.FILE_NAME }}
|
||||||
|
# cat ${{secrets.FILE_NAME}}
|
||||||
|
# if ! git diff-index --quiet HEAD --; then
|
||||||
|
# git add ${{secrets.FILE_NAME}}
|
||||||
|
# git status
|
||||||
|
# git commit -m "🐬 tags: "${{ github.sha }}" "
|
||||||
|
# git push
|
||||||
|
# else
|
||||||
|
# echo "no changes, git repository is up to date"
|
||||||
|
# fi
|
||||||
|
|
||||||
|
微信通知:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: ${{success()}}
|
||||||
|
needs: [build, gtiops]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
# 发送通知
|
||||||
|
- name: 微信通知
|
||||||
|
uses:
|
||||||
|
https://${{ env.DOMAIN }}/actions/action-wechat-work@master
|
||||||
|
# 若没有配置机器人WebHook则跳过
|
||||||
|
if: ${{ secrets.WECHAT_WORK_BOT_WEBHOOK != '' }}
|
||||||
|
env:
|
||||||
|
WECHAT_WORK_BOT_WEBHOOK: ${{ secrets.WECHAT_WORK_BOT_WEBHOOK }}
|
||||||
|
with:
|
||||||
|
msgtype: markdown
|
||||||
|
content: "✅ 应用版本更新成功\n
|
||||||
|
> 🐬 镜像:\n
|
||||||
|
> ${{ env.DOMAIN }}/${{ env.IMAGE_NAME }}:${{ github.sha}}\n
|
||||||
|
> 🍏 就能帮你到这了"
|
|
@ -0,0 +1,98 @@
|
||||||
|
name: CI
|
||||||
|
run-name: ${{ github.actor }} Gitea Actions 🚀🚀🚀
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
# Sequence of patterns matched against refs/heads
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
# Sequence of patterns matched against refs/tags
|
||||||
|
tags:
|
||||||
|
- v*
|
||||||
|
|
||||||
|
env:
|
||||||
|
# DOCKER_REGISTRY: docker.io
|
||||||
|
# DOCKER_USERNAME: softyouling
|
||||||
|
# 此处可修改为你任意 docker 镜像仓库地址和用户名
|
||||||
|
|
||||||
|
DOMAIN: gitea.lntu.edu.cn
|
||||||
|
# DOMAIN: softyouling-docker.pkg.coding.net
|
||||||
|
IMAGE_NAME: code/demo/demo
|
||||||
|
GITOPS_URL: ${{ env.DOMAIN }}/${{ secrets.GITOPS_REPO }}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
# container: catthehacker/ubuntu:act-latest
|
||||||
|
steps:
|
||||||
|
# - name: 环境检测
|
||||||
|
# run: |
|
||||||
|
# which node
|
||||||
|
# node --version
|
||||||
|
# which npm
|
||||||
|
# npm --version
|
||||||
|
# which docker
|
||||||
|
# docker info
|
||||||
|
# echo ${{ github.token }}
|
||||||
|
# echo ${{ env.GITOPS_URL }}
|
||||||
|
|
||||||
|
- name: 拉取代码
|
||||||
|
uses: https://${{ env.DOMAIN }}/actions/checkout@v4
|
||||||
|
|
||||||
|
# Docker配置多平台环境
|
||||||
|
- name: Docker配置多平台环境
|
||||||
|
uses: https://${{ env.DOMAIN }}/actions/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: 获取当前时间
|
||||||
|
id: date
|
||||||
|
run: echo "::set-output name=date::$(date +'%Y%m%d%H%M%S')"
|
||||||
|
|
||||||
|
- name: 构建 & 推送镜像
|
||||||
|
uses: https://${{ env.DOMAIN }}/actions/docker-build-push@v6
|
||||||
|
with:
|
||||||
|
image: ${{ env.IMAGE_NAME }}
|
||||||
|
tags: ${{ github.sha }}
|
||||||
|
registry: softyouling-docker.pkg.coding.net
|
||||||
|
# enableBuildKit: true
|
||||||
|
# multiPlatform: true
|
||||||
|
# platform: linux/amd64,linux/arm64,linux/arm/v7
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
|
|
||||||
|
gtiops:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: ${{ success() }}
|
||||||
|
needs: [build]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: 🐬更新应用镜像
|
||||||
|
uses: https://${{ env.DOMAIN }}/actions/gitops-action@main
|
||||||
|
with:
|
||||||
|
gitops-token: ${{ secrets.GITOPS_TOKEN }}
|
||||||
|
gitops-url: ${{ env.GITOPS_URL }}
|
||||||
|
commit-email: "gitops@lntu.edu.cn"
|
||||||
|
commit-name: "千里走单骑"
|
||||||
|
file-name: ${{ secrets.FILE_NAME }}
|
||||||
|
images-value: softyouling-docker.pkg.coding.net/code/demo/demo:${{ github.sha }}
|
||||||
|
image-tag: ${{ github.sha }}
|
||||||
|
|
||||||
|
微信通知:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: ${{success()}}
|
||||||
|
needs: [build, gtiops]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
# 发送通知
|
||||||
|
- name: 微信通知
|
||||||
|
uses:
|
||||||
|
https://${{ env.DOMAIN }}/actions/action-wechat-work@master
|
||||||
|
# 若没有配置机器人WebHook则跳过
|
||||||
|
if: ${{ secrets.WECHAT_WORK_BOT_WEBHOOK != '' }}
|
||||||
|
env:
|
||||||
|
WECHAT_WORK_BOT_WEBHOOK: ${{ secrets.WECHAT_WORK_BOT_WEBHOOK }}
|
||||||
|
with:
|
||||||
|
msgtype: markdown
|
||||||
|
content: "✅ 应用版本更新成功\n
|
||||||
|
> 🐬 镜像:\n
|
||||||
|
> softyouling-docker.pkg.coding.net/code/demo/demo:${{ github.sha }}\n
|
||||||
|
> 🍏 就能帮你到这了"
|
|
@ -0,0 +1,45 @@
|
||||||
|
name: Gitea Actions Demo
|
||||||
|
run-name: ${{ github.actor }} is testing out Gitea Actions
|
||||||
|
# on: [push]
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
# Sequence of patterns matched against refs/heads
|
||||||
|
# branches:
|
||||||
|
# - main
|
||||||
|
# # Sequence of patterns matched against refs/tags
|
||||||
|
tags:
|
||||||
|
- v*
|
||||||
|
env:
|
||||||
|
yamlrepo: youling/gitops
|
||||||
|
DOMAIN: gitea.lntu.edu.cn
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
Explore-Gitea-Actions:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
# - run: echo " The job was automatically triggered by a ${{ github.event_name }} event."
|
||||||
|
# - run: echo " This job is now running on a ${{ runner.os }} server hosted by Gitea!"
|
||||||
|
# - run: echo " The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
|
||||||
|
# # - name: Check out repository code
|
||||||
|
# # uses: actions/checkout@v3
|
||||||
|
# - run: echo " The token ${{ github.token }} "
|
||||||
|
# - run: echo " The ${{ github.repository }} repository has been cloned to the runner."
|
||||||
|
# - run: echo " The workflow is now ready to test your code on the runner."
|
||||||
|
# - run: echo " The workspace is ${{ github.workspace }}."
|
||||||
|
# - name: List files in the repository
|
||||||
|
# run: |
|
||||||
|
# ls ${{ github.workspace }}
|
||||||
|
# - run: echo " This job's status is ${{ job.status }}."
|
||||||
|
- name: Docker meta
|
||||||
|
id: meta
|
||||||
|
uses: https://${{ env.DOMAIN }}/actions/metadata-action@v5
|
||||||
|
with:
|
||||||
|
images: name/app
|
||||||
|
tags: type=schedule,pattern={{date 'YYYY/MM/DD-hhmmss'}}
|
||||||
|
- name: Get current date
|
||||||
|
id: date
|
||||||
|
run: echo "::set-output name=date::$(date +'%Y/%m/%d%H%M%S')"
|
||||||
|
|
||||||
|
- run: echo " The workspace is ${{ steps.date.outputs.date }} "
|
||||||
|
- run: echo " The workspace is ${{ steps.meta.outputs.tags }} "
|
||||||
|
- run: echo " The workspace is ${{ steps.meta.outputs }} "
|
|
@ -0,0 +1,4 @@
|
||||||
|
FROM docker.m.daocloud.io/mengzyou/bbhttpd:1.35 AS release
|
||||||
|
ENV TZ="Asia/Shanghai"
|
||||||
|
COPY index.html /home/www/html
|
||||||
|
EXPOSE 80
|
Binary file not shown.
After Width: | Height: | Size: 708 KiB |
|
@ -0,0 +1 @@
|
||||||
|
hello world docker run
|
Loading…
Reference in New Issue