From ebb157062a3f164178a51d63fbec082040df9976 Mon Sep 17 00:00:00 2001 From: yokinanya Date: Mon, 22 Jul 2024 23:32:44 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E5=8F=96=E7=89=88=E6=9C=AC=E5=8F=B7?= =?UTF-8?q?=E5=B9=B6=E8=AE=BE=E7=BD=AE=E7=8E=AF=E5=A2=83=E5=8F=98=E9=87=8F?= =?UTF-8?q?=EF=BC=8C=E9=81=BF=E5=85=8D=20`set-output`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci_release.yml | 80 ++++++++++++++++---------------- 1 file changed, 41 insertions(+), 39 deletions(-) diff --git a/.github/workflows/ci_release.yml b/.github/workflows/ci_release.yml index a6794cc..e997863 100644 --- a/.github/workflows/ci_release.yml +++ b/.github/workflows/ci_release.yml @@ -4,7 +4,7 @@ on: pull_request: branches: - main - types: + types: - closed jobs: @@ -13,41 +13,43 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout repository - uses: actions/checkout@v2 - - - name: Set up Node.js - uses: actions/setup-node@v2 - with: - node-version: "14" - - - name: Extract version from PR title - id: extract_version - run: echo "::set-output name=version::$(echo ${GITHUB_EVENT_PULL_REQUEST_TITLE} | sed 's/Release //')" - - - name: Create Release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ steps.extract_version.outputs.version }} - release_name: Release ${{ steps.extract_version.outputs.version }} - body: | - This is the release description for version ${{ steps.extract_version.outputs.version }}. - draft: false - prerelease: false - - - name: Create zip file - run: | - zip -r DGTExtra_datapack_${{ steps.extract_version.outputs.version }}.zip data LICENSE pack.mcmeta pack.png README.md - - - name: Upload Release Asset - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./DGTExtra_datapack_${{ steps.extract_version.outputs.version }}.zip - asset_name: DGTExtra_datapack_${{ steps.extract_version.outputs.version }}.zip - asset_content_type: application/zip + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up Node.js + uses: actions/setup-node@v2 + with: + node-version: '14' + + - name: Extract version from PR title + id: extract_version + run: | + VERSION=$(echo "${{ github.event.pull_request.title }}" | sed 's/Release //') + echo "VERSION=${VERSION}" >> $GITHUB_ENV + + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ env.VERSION }} + release_name: Release ${{ env.VERSION }} + body: | + This is the release description for version ${{ env.VERSION }}. + draft: false + prerelease: false + + - name: Create zip file + run: | + zip -r DGTExtra_datapack_${{ env.VERSION }}.zip data LICENSE pack.mcmeta pack.png README.md + + - name: Upload Release Asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./DGTExtra_datapack_${{ env.VERSION }}.zip + asset_name: DGTExtra_datapack_${{ env.VERSION }}.zip + asset_content_type: application/zip