更新 .gitea/workflows/test.yml

This commit is contained in:
2026-06-15 10:50:06 +08:00
parent b7b2a18dfc
commit 549bd325ee
+35 -15
View File
@@ -1,19 +1,39 @@
name: Gitea Actions Demo
run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀
on: [push]
name: Build and Push Next.js to Private Registry
on:
push:
branches:
- main
jobs:
Explore-Gitea-Actions:
build-and-push:
runs-on: ubuntu-latest
steps:
- run: echo "🎉 The job was automatically triggered by a ${{ gitea.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 ${{ gitea.ref }} and your repository is ${{ gitea.repository }}."
- name: Check out repository code
uses: actions/checkout@v3
- run: echo "💡 The ${{ gitea.repository }} repository has been cloned to the runner."
- run: echo "🖥️ The workflow is now ready to test your code on the runner."
- name: List files in the repository
run: |
ls ${{ gitea.workspace }}
- run: echo "🍏 This job's status is ${{ job.status }}."
- name: 检查代码
uses: actions/checkout@v4
- name: 生成短哈希版本号
id: vars
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
# 关键步骤:配置 Buildx 允许不安全的 HTTP 私有仓库
- name: 设置 Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver-opts: |
image=moby/buildkit:master
config-inline: |
[registry."192.168.10.236:31051"]
http = true
insecure = true
- name: 构建并推送镜像
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
# 必须将镜像前缀改为你的私有仓库 IP 和端口
tags: |
192.168.10.236:31051/你的应用名:latest
192.168.10.236:31051/你的应用名:${{ steps.vars.outputs.sha_short }}