diff --git a/.gitea/workflows/demo.yaml b/.gitea/workflows/demo.yaml index 81e38be..cd584dc 100644 --- a/.gitea/workflows/demo.yaml +++ b/.gitea/workflows/demo.yaml @@ -188,12 +188,16 @@ jobs: runs-on: ${{ matrix.runs-on }} steps: - 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 uses: actions/upload-artifact@v3 #github公开版可以用v4 with: name: my-artifact-${{ matrix.runs-on }} - path: file-${{ matrix.runs-on }}.txt + path: | + file-${{ matrix.runs-on }}.txt + meta.json download: needs: upload runs-on: ubuntu-latest @@ -202,13 +206,20 @@ jobs: uses: actions/download-artifact@v3 #github公开版可以用v4 with: path: my-artifact - pattern: my-artifact-* + # pattern: my-artifact-* # 匹配名称 # merge-multiple: true # 合并多个文件,会生成一个新的file-xxxx文件 # 下载其他仓库的制品 # github-token: ${{ secrets.GH_PAT }} # repository: actions/toolkit # run-id: 1234 - 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 run: | mkdir release @@ -239,6 +250,7 @@ jobs: # token: ${{ secrets.CUSTOM_GITHUB_TOKEN }} # name: 发布名称。默认为标签名称 # tag_name: 标签名称。默认为github.ref_name + tag_name: with: files: | *.txt