initial
This commit is contained in:
100
.gitea/workflows/cicd.yaml
Normal file
100
.gitea/workflows/cicd.yaml
Normal file
@@ -0,0 +1,100 @@
|
||||
name: Actions
|
||||
run-name: ${{ gitea.actor }} 🚀
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
|
||||
jobs:
|
||||
Explore-Gitea-Actions:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Clean temp directory
|
||||
run: rm -rf *
|
||||
# 设置 Go 环境
|
||||
- name: 设置 Go
|
||||
uses: https://git.apinb.com/github/setup-go@v5
|
||||
with:
|
||||
go-version: '1.24.6'
|
||||
tag_name: ${{ gitea.ref }}
|
||||
release_name: ${{ gitea.ref }}
|
||||
|
||||
- run: echo "🎉 The job was automatically triggered by a ${{ gitea.event_name }} event."
|
||||
- run: echo "🔎 The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository_owner }}."
|
||||
- name: Extract repository name
|
||||
id: extract_repo
|
||||
run: |
|
||||
repo_name=$(echo ${{ gitea.repository }} | cut -d'/' -f2)
|
||||
echo "Repository name: $repo_name"
|
||||
echo "::set-output name=repo_name::$repo_name"
|
||||
|
||||
# 提取tag标签名称
|
||||
- name: Extract tag name
|
||||
id: extract_tag
|
||||
run: echo "::set-output name=tag_name::$(echo ${{ gitea.ref }} | sed 's/^refs\/tags\///')"
|
||||
- run: echo "🏷 The tag name is ${{ steps.extract_tag.outputs.tag_name }}."
|
||||
|
||||
# 检查出代码
|
||||
- name: Check out repository code
|
||||
uses: https://git.apinb.com/github/checkout@v4
|
||||
|
||||
# 缓存 Go 依赖项
|
||||
- name: Cache Go modules
|
||||
uses: https://git.apinb.com/github/cache@v4
|
||||
with:
|
||||
path: |
|
||||
~/.cache/go-build
|
||||
~/go/pkg/mod
|
||||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-go-
|
||||
|
||||
|
||||
- name: set last version
|
||||
run: |
|
||||
echo "export srv_version='${{ steps.extract_tag.outputs.tag_name }}';export srv_name='${{ steps.extract_repo.outputs.repo_name }}'" > ${{ gitea.repository_owner }}-${{ steps.extract_repo.outputs.repo_name }}_last_version.sh
|
||||
- run: go env -w GOPROXY=https://goproxy.cn
|
||||
- run: go env -w GOPRIVATE=git.apinb.com/*
|
||||
- run: go env -w GONOPROXY=git.apinb.com/*
|
||||
- run: go env -w GOINSECURE=git.apinb.com/*
|
||||
- run: go env -w GONOSUMDB=git.apinb.com/*
|
||||
- run: go build -o ${{ gitea.repository_owner }}-${{ steps.extract_repo.outputs.repo_name }} ./cmd/main/main.go
|
||||
- run: echo "🍏 This job's status is ${{ job.status }}."
|
||||
- name: upload bin to minio oss - 1
|
||||
uses: https://git.apinb.com/github/minio-upload@main
|
||||
with:
|
||||
endpoint: http://172.24.0.20:9000
|
||||
access-key-id: 9jtPPB7wwJpe5R2164bS
|
||||
access-key-secret: ho9LYavUIGdkf0b50aaOduIA4zdx8FQFWpUYx30p
|
||||
bucket: reles
|
||||
source: ./${{ gitea.repository_owner }}-${{ steps.extract_repo.outputs.repo_name }}_last_version.sh
|
||||
insecure: true
|
||||
recursive: true
|
||||
|
||||
- name: upload bin to minio oss - 2
|
||||
uses: https://git.apinb.com/github/minio-upload@main
|
||||
with:
|
||||
endpoint: http://172.24.0.20:9000
|
||||
access-key-id: 9jtPPB7wwJpe5R2164bS
|
||||
access-key-secret: ho9LYavUIGdkf0b50aaOduIA4zdx8FQFWpUYx30p
|
||||
bucket: reles
|
||||
source: ./${{ gitea.repository_owner }}-${{ steps.extract_repo.outputs.repo_name }}
|
||||
target: /${{ gitea.repository_owner }}-${{ steps.extract_repo.outputs.repo_name }}@${{ steps.extract_tag.outputs.tag_name }}/
|
||||
insecure: true
|
||||
recursive: false
|
||||
|
||||
- name: upload bin to minio oss - 3
|
||||
uses: https://git.apinb.com/github/minio-upload@main
|
||||
with:
|
||||
endpoint: http://172.24.0.20:9000
|
||||
access-key-id: 9jtPPB7wwJpe5R2164bS
|
||||
access-key-secret: ho9LYavUIGdkf0b50aaOduIA4zdx8FQFWpUYx30p
|
||||
bucket: reles
|
||||
source: ./etc
|
||||
target: /${{ gitea.repository_owner }}-${{ steps.extract_repo.outputs.repo_name }}@${{ steps.extract_tag.outputs.tag_name }}/
|
||||
insecure: true
|
||||
recursive: true
|
||||
|
||||
- name: upload success
|
||||
run: echo "build&upload success."
|
||||
Reference in New Issue
Block a user