更新 .gitea/workflows/demo.yaml
自动流水线示例 / build (push) Successful in 1m47s Details
自动流水线示例 / upload (ubuntu-latest) (push) Successful in 18s Details
自动流水线示例 / deploy (push) Successful in 17s Details
自动流水线示例 / download (push) Failing after 22s Details
自动流水线示例 / 检查 (push) Successful in 7s 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 14:03:32 +00:00
parent 1549b52d16
commit f5f426ae2e
1 changed files with 9 additions and 3 deletions

View File

@ -182,11 +182,15 @@ jobs:
echo 'Artifact URL is ${{ steps.artifact-upload-step-id.artifact-url }}' echo 'Artifact URL is ${{ steps.artifact-upload-step-id.artifact-url }}'
echo 'Artifact SHA 256 is ${{ steps.artifact-upload-step-id.artifact-digest }}' echo 'Artifact SHA 256 is ${{ steps.artifact-upload-step-id.artifact-digest }}'
upload: upload:
outputs:
tag-name: ${{ steps.set-tag.outputs.tag }} # 设置一个输出标签。对外包露tag-name值来自于当前job下steps下id叫set-tag的环境变量tag
strategy: strategy:
matrix: matrix:
runs-on: [ubuntu-latest] # [ubuntu-latest, macos-latest, windows-latest] runs-on: [ubuntu-latest] # [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.runs-on }} runs-on: ${{ matrix.runs-on }}
steps: steps:
- id: set-tag
run: echo "tag=release-$(TZ=+8 date '+%Y-%m-%d_%H_%M_%S')" >> $GITHUB_OUTPUT # 把变量输出到github的输出环境上面的outputs就能获取到
- name: Create a File - name: Create a File
run: | run: |
echo "$(TZ=+8 date '+%Y%m%d%H%M%S') hello from ${{ matrix.runs-on }}" > file-${{ matrix.runs-on }}.txt echo "$(TZ=+8 date '+%Y%m%d%H%M%S') hello from ${{ matrix.runs-on }}" > file-${{ matrix.runs-on }}.txt
@ -202,6 +206,8 @@ jobs:
needs: upload needs: upload
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: 获取跨job上游job的输出变量值
run: echo "The tag from previous job is ${{ needs.upload.outputs.tag-name }}"
- name: Download All Artifacts - name: Download All Artifacts
uses: actions/download-artifact@v3 #github公开版可以用v4 uses: actions/download-artifact@v3 #github公开版可以用v4
with: with:
@ -215,7 +221,7 @@ jobs:
- run: ls -R my-artifact - run: ls -R my-artifact
- name: 读取跨job文件中的变量 - name: 读取跨job文件中的变量
run: | run: |
version=$(jq -r .version ./meta.json) version=$(jq -r .version ./my-artifact/meta.json)
echo "Version is $version #变量在$GITHUB_ENV中存放,可实现同一个steps可以共享" echo "Version is $version #变量在$GITHUB_ENV中存放,可实现同一个steps可以共享"
echo "VERSION=$version" >> $GITHUB_ENV echo "VERSION=$version" >> $GITHUB_ENV
- name: Use shared version - name: Use shared version
@ -224,7 +230,7 @@ jobs:
run: | run: |
mkdir release mkdir release
# find all-artifacts -type f -exec cp {} release/ \; # find all-artifacts -type f -exec cp {} release/ \;
find . -type f -exec cp {} release/ \; find ./my-artifact -type f -exec cp {} release/ \;
ls -lah ./release ls -lah ./release
- name: Generate SHA-256 - name: Generate SHA-256
run: | run: |
@ -250,7 +256,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: dfsf tag_name: ${{ needs.upload.outputs.tag-name }}
with: with:
files: | files: |
*.txt *.txt