ci(docker): 更新Gitea工作流配置并优化构建步骤
- 使用标准actions/checkout@v4替代自定义checkout - 添加Go环境设置步骤并启用缓存 - 优化SSH action使用标准appleboy/ssh-action - 调整工作空间路径变量为github标准
This commit is contained in:
parent
84842ec3dd
commit
dad83339c1
@ -25,7 +25,6 @@ jobs:
|
|||||||
runs-on: vpn
|
runs-on: vpn
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
# 使用gitea-tool-cache需要指定具体的版本号
|
|
||||||
go: ["1.24.3"]
|
go: ["1.24.3"]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
@ -33,12 +32,26 @@ jobs:
|
|||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: '18'
|
node-version: '18'
|
||||||
|
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: https://${{ env.GIT_USERNAME }}:${{ env.GIT_PASSWORD }}@${{ vars.DOMAIN_OF_GITEA}}/actions/checkout@v1
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
# 将.env环境变量配置文件拷贝致gitea runner容器
|
- name: Setup Go environment with cache
|
||||||
- name: copy env file to runner container
|
uses: actions/setup-go@v5
|
||||||
uses: https://${{ env.GIT_USERNAME }}:${{ env.GIT_PASSWORD }}@${{ vars.DOMAIN_OF_GITEA}}/actions/ssh-action@v1
|
with:
|
||||||
|
go-version: ${{ matrix.go }}
|
||||||
|
cache: true
|
||||||
|
cache-dependency-path: go.sum
|
||||||
|
|
||||||
|
- name: Prepare GO environment
|
||||||
|
run: |
|
||||||
|
go env -w GOPROXY=https://goproxy.cn,direct
|
||||||
|
go env -w GOPRIVATE="${{ vars.DOMAIN_OF_GITEA}}"
|
||||||
|
go env -w GOSUMDB=off
|
||||||
|
git config --global url."https://${{ env.GIT_USERNAME }}:${{ env.GIT_PASSWORD }}@${{ vars.DOMAIN_OF_GITEA}}/".insteadOf "https://${{ vars.DOMAIN_OF_GITEA}}/"
|
||||||
|
|
||||||
|
- name: Copy env file to runner container
|
||||||
|
uses: appleboy/ssh-action@v1.0.0
|
||||||
with:
|
with:
|
||||||
host: ${{ env.SSH_HOST }}
|
host: ${{ env.SSH_HOST }}
|
||||||
username: ${{ env.SSH_USER }}
|
username: ${{ env.SSH_USER }}
|
||||||
@ -58,24 +71,9 @@ jobs:
|
|||||||
echo "RUNNER_CONTAINER_NAME is not set, skipping container operations"
|
echo "RUNNER_CONTAINER_NAME is not set, skipping container operations"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Setup Go environment with cache
|
|
||||||
uses: https://${{ env.GIT_USERNAME }}:${{ env.GIT_PASSWORD }}@${{ vars.DOMAIN_OF_GITEA}}/actions/setup-go@main
|
|
||||||
with:
|
|
||||||
go-version: ${{ matrix.go }}
|
|
||||||
cache: true
|
|
||||||
cache-dependency-path: go.sum
|
|
||||||
|
|
||||||
|
|
||||||
- name: Prepare GO environment
|
|
||||||
run: |
|
|
||||||
go env -w GOPROXY=https://goproxy.cn,direct
|
|
||||||
go env -w GOPRIVATE="${{ vars.DOMAIN_OF_GITEA}}"
|
|
||||||
go env -w GOSUMDB=off
|
|
||||||
git config --global url."https://${{ env.GIT_USERNAME }}:${{ env.GIT_PASSWORD }}@${{ vars.DOMAIN_OF_GITEA}}/".insteadOf "https://${{ vars.DOMAIN_OF_GITEA}}/"
|
|
||||||
|
|
||||||
- name: Build and push docker image
|
- name: Build and push docker image
|
||||||
run: |
|
run: |
|
||||||
source ${{ gitea.workspace }}/deploy/.env
|
source ${{ github.workspace }}/deploy/.env
|
||||||
go mod tidy
|
go mod tidy
|
||||||
make build-linux
|
make build-linux
|
||||||
make docker
|
make docker
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user