ernoban commited on
Commit
753c8d9
·
verified ·
1 Parent(s): 33cc743

Delete .github

Browse files
.github/workflows/docker-build-push.yml DELETED
@@ -1,79 +0,0 @@
1
- name: Build and Push Docker Image
2
- on:
3
- push:
4
- # branches: [ "main" ]
5
- tags: [ 'v*.*.*' ]
6
- pull_request:
7
- branches: [ "main" ]
8
- # 也可以手动触发
9
- workflow_dispatch:
10
- jobs:
11
- build-and-push:
12
- runs-on: ubuntu-latest
13
- permissions:
14
- contents: read
15
- packages: write
16
- steps:
17
- - name: Checkout repository
18
- uses: actions/checkout@v4
19
- - name: Set up Docker Buildx
20
- uses: docker/setup-buildx-action@v3
21
- # 登录到 GitHub 容器仓库
22
- - name: Login to GitHub Container Registry
23
- uses: docker/login-action@v3
24
- with:
25
- registry: ghcr.io
26
- username: ${{ github.repository_owner }}
27
- password: ${{ secrets.GITHUB_TOKEN }}
28
- # 提取仓库名称作为镜像名
29
- - name: Extract repository name
30
- id: repo-name
31
- run: echo "REPO_NAME=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT
32
-
33
- # 提取 Git tag 作为版本号
34
- - name: Extract tag version
35
- id: tag-version
36
- if: startsWith(github.ref, 'refs/tags/v')
37
- run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
38
-
39
- # 设置默认版本标签
40
- - name: Set default version
41
- id: version
42
- run: |
43
- if [[ "${{ github.ref }}" == refs/tags/v* ]]; then
44
- echo "TAG=${{ steps.tag-version.outputs.VERSION }}" >> $GITHUB_OUTPUT
45
- else
46
- SHORT_SHA=$(echo ${GITHUB_SHA} | cut -c1-7)
47
- DATE=$(date +'%Y%m%d')
48
- echo "TAG=${DATE}-${SHORT_SHA}" >> $GITHUB_OUTPUT
49
- fi
50
-
51
- - name: Build and Push Images
52
- uses: docker/build-push-action@v5
53
- with:
54
- context: .
55
- push: true
56
- tags: |
57
- ghcr.io/${{ steps.repo-name.outputs.REPO_NAME }}:latest
58
- ghcr.io/${{ steps.repo-name.outputs.REPO_NAME }}:${{ steps.version.outputs.TAG }}
59
-
60
- # 专门为 ARM64 架构构建并推送镜像
61
- - name: Build and Push ARM64 Image
62
- uses: docker/build-push-action@v5
63
- with:
64
- context: .
65
- push: true
66
- platforms: linux/arm64
67
- tags: |
68
- ghcr.io/${{ steps.repo-name.outputs.REPO_NAME }}:arm-latest
69
- ${{ github.ref_type == 'tag' && format('ghcr.io/{0}:arm-{1}', steps.repo-name.outputs.REPO_NAME, steps.version.outputs.TAG) || '' }}
70
-
71
- # 输出镜像信息
72
- - name: Image digest
73
- run: |
74
- echo " image has been pushed to ghcr.io/${{ steps.repo-name.outputs.REPO_NAME }}:latest"
75
- echo " image has been pushed to ghcr.io/${{ steps.repo-name.outputs.REPO_NAME }}:${{ steps.version.outputs.TAG }}"
76
- echo "ARM64-only image has been pushed to ghcr.io/${{ steps.repo-name.outputs.REPO_NAME }}:arm-latest"
77
- if [[ "${{ github.ref }}" == refs/tags/v* ]]; then
78
- echo "ARM64-only image has been pushed to ghcr.io/${{ steps.repo-name.outputs.REPO_NAME }}:arm-${{ steps.version.outputs.TAG }}"
79
- fi
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
.github/workflows/release.yml DELETED
@@ -1,53 +0,0 @@
1
- name: Publish Release
2
-
3
- on:
4
- push:
5
- tags:
6
- - 'v*' # 当推送以 "v" 开头的标签时触发(如 v1.0.0, v2.1.0)
7
-
8
- jobs:
9
- update-release-draft:
10
- permissions:
11
- contents: write
12
- pull-requests: write
13
- runs-on: ubuntu-latest
14
- steps:
15
- # Step 1: 检出代码库
16
- - name: Checkout code
17
- uses: actions/checkout@v3
18
-
19
- # Step 2: 获取项目名称
20
- - name: Get Project Name
21
- id: project_info
22
- run: |
23
- REPO_NAME=${GITHUB_REPOSITORY#*/}
24
- echo "repo_name=$REPO_NAME" >> $GITHUB_OUTPUT
25
- echo "Using repository name: $REPO_NAME"
26
-
27
- # Step 3: 自动生成 Release
28
- - name: Create Release
29
- id: create_release
30
- uses: actions/create-release@v1
31
- env:
32
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33
- with:
34
- tag_name: ${{ github.ref_name }}
35
- release_name: ${{ github.ref_name }}
36
- draft: false
37
- prerelease: false
38
-
39
- # Step 4: 构建zip文件
40
- - name: Create ZIP file
41
- run: |
42
- zip -r ${{ steps.project_info.outputs.repo_name }}.zip . -x "*.git*" "*.github*" "*.env*" "logs/*" "tests/*"
43
-
44
- # Step 5: 上传构建文件
45
- - name: Upload Release Asset
46
- uses: actions/upload-release-asset@v1
47
- env:
48
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
49
- with:
50
- upload_url: ${{ steps.create_release.outputs.upload_url }}
51
- asset_path: ./${{ steps.project_info.outputs.repo_name }}.zip
52
- asset_name: ${{ steps.project_info.outputs.repo_name }}.zip
53
- asset_content_type: application/zip