From 25594fc80c1f8b430e3b180219beac3f2e8a861d Mon Sep 17 00:00:00 2001 From: yokinanya Date: Mon, 22 Jul 2024 23:26:53 +0800 Subject: [PATCH] update actions --- .github/workflows/ci_release.yml | 53 +++++++++++++++++++++++++++ .github/workflows/create-release.yml | 15 -------- .github/workflows/generate-lables.yml | 14 ------- 3 files changed, 53 insertions(+), 29 deletions(-) create mode 100644 .github/workflows/ci_release.yml delete mode 100644 .github/workflows/create-release.yml delete mode 100644 .github/workflows/generate-lables.yml diff --git a/.github/workflows/ci_release.yml b/.github/workflows/ci_release.yml new file mode 100644 index 0000000..a6794cc --- /dev/null +++ b/.github/workflows/ci_release.yml @@ -0,0 +1,53 @@ +name: Release + +on: + pull_request: + branches: + - main + types: + - closed + +jobs: + release: + if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.title, 'Release') + 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 diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml deleted file mode 100644 index 6cb4b4a..0000000 --- a/.github/workflows/create-release.yml +++ /dev/null @@ -1,15 +0,0 @@ -name: 'Create Release' - -on: - push: - tags: - - 'v*.*' - -jobs: - release: - runs-on: ubuntu-latest - steps: - - name: 'Create Release' - uses: softprops/action-gh-release@v2 - with: - generate_release_notes: true \ No newline at end of file diff --git a/.github/workflows/generate-lables.yml b/.github/workflows/generate-lables.yml deleted file mode 100644 index 8c1999f..0000000 --- a/.github/workflows/generate-lables.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: 'Generate Labels' - -on: - pull_request: - types: [opened, edited, synchronize] - -jobs: - label: - name: 'Label PR based on title' - runs-on: ubuntu-latest - steps: - - uses: srvaroa/labeler@master - env: - GITHUB_TOKEN: ${{ github.token }} \ No newline at end of file