diff --git a/.gitea/workflows/demo.yaml b/.gitea/workflows/demo.yaml index 82570a0..2e6641d 100644 --- a/.gitea/workflows/demo.yaml +++ b/.gitea/workflows/demo.yaml @@ -190,10 +190,11 @@ jobs: runs-on: ${{ matrix.runs-on }} steps: - id: set-tag - run: echo "tag=release-$(TZ=+8 date '+%Y-%m-%d_%H_%M_%S')" >> $GITHUB_OUTPUT # 把变量输出到github的输出环境,上面的outputs就能获取到 + # run: echo "tag=release-$(TZ=+8 date '+%Y-%m-%d_%H_%M_%S')" >> $GITHUB_OUTPUT # 把变量输出到github的输出环境,上面的outputs就能获取到 + run: echo "tag=release-$(TZ='Asia/Shanghai' date '+%Y-%m-%d_%H_%M_%S')" >> $GITHUB_OUTPUT - 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 + echo "$(TZ='Asia/Shanghai' 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 @@ -206,6 +207,11 @@ jobs: needs: upload runs-on: ubuntu-latest steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Set release tag as date + id: vars + run: echo "tag=release-$(TZ='Asia/Shanghai' date +'%Y%m%d%H%M%S')" >> $GITHUB_OUTPUT # 包含$GITHUB_ENV 的作用域,全steps也可访问 - name: 获取跨job上游job的输出变量值 run: echo "The tag from previous job is ${{ needs.upload.outputs.tag-name }}" - name: Download All Artifacts @@ -252,13 +258,17 @@ jobs: echo "获取gitea: ${{ gitea.repository }}" - name: 上传Release uses: softprops/action-gh-release@v2 + #env: + #GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} #if: github.ref_type == 'tag' # body_path: ${{ github.workspace }}-CHANGELOG.txt # 加载文本的路径,用于传达此版本中的显著变化 # repository: my_gh_org/my_gh_repo # token: ${{ secrets.CUSTOM_GITHUB_TOKEN }} # name: 发布名称。默认为标签名称 # tag_name: 标签名称。默认为github.ref_name - tag_name: ${{ needs.upload.outputs.tag-name }} + #tag_name: ${{ needs.upload.outputs.tag-name }} + tag_name: ${{ steps.vars.outputs.tag }} + name: "Release ${{ steps.vars.outputs.tag }}" with: files: | *.txt