更新 .gitea/workflows/demo.yaml
自动流水线示例 / build (push) Successful in 1m55s Details
自动流水线示例 / upload (ubuntu-latest) (push) Successful in 25s Details
自动流水线示例 / deploy (push) Successful in 19s Details
自动流水线示例 / download (push) Failing after 20s Details
自动流水线示例 / 检查 (push) Successful in 11s Details
自动流水线示例 / 制品上传 (ubuntu-latest, a) (push) Has been skipped Details
自动流水线示例 / 制品上传 (ubuntu-latest, b) (push) Has been skipped Details
自动流水线示例 / 制品上传 (ubuntu-latest, c) (push) Has been skipped Details

发布生产
This commit is contained in:
xiehaijun 2025-07-27 13:39:54 +00:00
parent bae4b6363d
commit 50b7021554
1 changed files with 15 additions and 3 deletions

View File

@ -188,12 +188,16 @@ jobs:
runs-on: ${{ matrix.runs-on }} runs-on: ${{ matrix.runs-on }}
steps: steps:
- name: Create a File - name: Create a File
run: echo "$(TZ=+8 date '+%Y%m%d%H%M%S') hello from ${{ matrix.runs-on }}" > file-${{ matrix.runs-on }}.txt run: |
echo "$(TZ=+8 date '+%Y%m%d%H%M%S') hello from ${{ matrix.runs-on }}" > file-${{ matrix.runs-on }}.txt
echo '{"version": "1.0.0", "build": "1234"}' > meta.json # 跨job传递参数
- name: Upload Artifact - name: Upload Artifact
uses: actions/upload-artifact@v3 #github公开版可以用v4 uses: actions/upload-artifact@v3 #github公开版可以用v4
with: with:
name: my-artifact-${{ matrix.runs-on }} name: my-artifact-${{ matrix.runs-on }}
path: file-${{ matrix.runs-on }}.txt path: |
file-${{ matrix.runs-on }}.txt
meta.json
download: download:
needs: upload needs: upload
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -202,13 +206,20 @@ jobs:
uses: actions/download-artifact@v3 #github公开版可以用v4 uses: actions/download-artifact@v3 #github公开版可以用v4
with: with:
path: my-artifact path: my-artifact
pattern: my-artifact-* # pattern: my-artifact-* # 匹配名称
# merge-multiple: true # 合并多个文件,会生成一个新的file-xxxx文件 # merge-multiple: true # 合并多个文件,会生成一个新的file-xxxx文件
# 下载其他仓库的制品 # 下载其他仓库的制品
# github-token: ${{ secrets.GH_PAT }} # github-token: ${{ secrets.GH_PAT }}
# repository: actions/toolkit # repository: actions/toolkit
# run-id: 1234 # run-id: 1234
- run: ls -R my-artifact - run: ls -R my-artifact
- name: 读取跨job文件中的变量
run: |
version=$(jq -r .version meta.json)
echo "Version is $version"
echo "VERSION=$version" >> $GITHUB_ENV
- name: Use shared version
run: echo "读取跨job的变量=$VERSION"
- name: Flatten directory - name: Flatten directory
run: | run: |
mkdir release mkdir release
@ -239,6 +250,7 @@ jobs:
# token: ${{ secrets.CUSTOM_GITHUB_TOKEN }} # token: ${{ secrets.CUSTOM_GITHUB_TOKEN }}
# name: 发布名称。默认为标签名称 # name: 发布名称。默认为标签名称
# tag_name: 标签名称。默认为github.ref_name # tag_name: 标签名称。默认为github.ref_name
tag_name:
with: with:
files: | files: |
*.txt *.txt