更新 .gitea/workflows/test.yml
This commit is contained in:
+35
-15
@@ -1,19 +1,39 @@
|
|||||||
name: Gitea Actions Demo
|
name: Build and Push Next.js to Private Registry
|
||||||
run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀
|
|
||||||
on: [push]
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
Explore-Gitea-Actions:
|
build-and-push:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- run: echo "🎉 The job was automatically triggered by a ${{ gitea.event_name }} event."
|
- name: 检查代码
|
||||||
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by Gitea!"
|
uses: actions/checkout@v4
|
||||||
- run: echo "🔎 The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}."
|
|
||||||
- name: Check out repository code
|
- name: 生成短哈希版本号
|
||||||
uses: actions/checkout@v3
|
id: vars
|
||||||
- run: echo "💡 The ${{ gitea.repository }} repository has been cloned to the runner."
|
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
|
||||||
- run: echo "🖥️ The workflow is now ready to test your code on the runner."
|
|
||||||
- name: List files in the repository
|
# 关键步骤:配置 Buildx 允许不安全的 HTTP 私有仓库
|
||||||
run: |
|
- name: 设置 Docker Buildx
|
||||||
ls ${{ gitea.workspace }}
|
uses: docker/setup-buildx-action@v3
|
||||||
- run: echo "🍏 This job's status is ${{ job.status }}."
|
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 }}
|
||||||
Reference in New Issue
Block a user