From 816c94e8161c7efd3446d968717a61a05d9de769 Mon Sep 17 00:00:00 2001 From: Andrey Shcheglov Date: Mon, 14 Nov 2022 17:51:26 +0300 Subject: [PATCH] Don't create the same release twice (#17) --- .github/workflows/bindist-full.yml | 18 +++++------------- .github/workflows/bindist-thin.yml | 18 +++++------------- .github/workflows/release.yml | 16 ++++++++++++++++ 3 files changed, 26 insertions(+), 26 deletions(-) diff --git a/.github/workflows/bindist-full.yml b/.github/workflows/bindist-full.yml index 04e6874..368397e 100644 --- a/.github/workflows/bindist-full.yml +++ b/.github/workflows/bindist-full.yml @@ -6,6 +6,9 @@ on: release-version: required: true type: string + upload-url: + required: true + type: string jobs: dist: @@ -62,17 +65,6 @@ jobs: if-no-files-found: error retention-days: 1 - - id: create_release - if: ${{ github.ref_type == 'tag' }} - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ github.token }} - with: - tag_name: ${{ github.ref }} - release_name: v${{ inputs.release-version }} - draft: false - prerelease: false - - name: Upload release asset (${{ steps.filenames.outputs.diktat-cli-tgz }}) id: upload-release-asset-tgz if: ${{ github.ref_type == 'tag' }} @@ -80,7 +72,7 @@ jobs: env: GITHUB_TOKEN: ${{ github.token }} with: - upload_url: ${{ steps.create_release.outputs.upload_url }} + upload_url: ${{ inputs.upload-url }} asset_path: ${{ steps.filenames.outputs.diktat-cli-tgz }} asset_name: ${{ steps.filenames.outputs.diktat-cli-tgz }} asset_content_type: application/gzip @@ -92,7 +84,7 @@ jobs: env: GITHUB_TOKEN: ${{ github.token }} with: - upload_url: ${{ steps.create_release.outputs.upload_url }} + upload_url: ${{ inputs.upload-url }} asset_path: ${{ steps.filenames.outputs.diktat-cli-zip }} asset_name: ${{ steps.filenames.outputs.diktat-cli-zip }} asset_content_type: application/zip diff --git a/.github/workflows/bindist-thin.yml b/.github/workflows/bindist-thin.yml index 65b642e..0c0bbe7 100644 --- a/.github/workflows/bindist-thin.yml +++ b/.github/workflows/bindist-thin.yml @@ -6,6 +6,9 @@ on: release-version: required: true type: string + upload-url: + required: true + type: string jobs: dist: @@ -50,17 +53,6 @@ jobs: if-no-files-found: error retention-days: 1 - - id: create_release - if: ${{ github.ref_type == 'tag' }} - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ github.token }} - with: - tag_name: ${{ github.ref }} - release_name: v${{ inputs.release-version }} - draft: false - prerelease: false - - name: Upload release asset (${{ steps.filenames.outputs.diktat-cli-tgz }}) id: upload-release-asset-tgz if: ${{ github.ref_type == 'tag' }} @@ -68,7 +60,7 @@ jobs: env: GITHUB_TOKEN: ${{ github.token }} with: - upload_url: ${{ steps.create_release.outputs.upload_url }} + upload_url: ${{ inputs.upload-url }} asset_path: ${{ steps.filenames.outputs.diktat-cli-tgz }} asset_name: ${{ steps.filenames.outputs.diktat-cli-tgz }} asset_content_type: application/gzip @@ -80,7 +72,7 @@ jobs: env: GITHUB_TOKEN: ${{ github.token }} with: - upload_url: ${{ steps.create_release.outputs.upload_url }} + upload_url: ${{ inputs.upload-url }} asset_path: ${{ steps.filenames.outputs.diktat-cli-zip }} asset_name: ${{ steps.filenames.outputs.diktat-cli-zip }} asset_content_type: application/zip diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 822d567..bf7f679 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -37,8 +37,22 @@ jobs: echo "release-version=${RELEASE_VERSION}" >>"${GITHUB_OUTPUT}" shell: bash + + - id: release + name: Create the release + if: ${{ github.ref_type == 'tag' }} + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ github.token }} + with: + tag_name: ${{ github.ref }} + release_name: v${{ steps.version.outputs.release-version }} + draft: false + prerelease: false + outputs: release-version: ${{ steps.version.outputs.release-version }} + upload-url: ${{ steps.release.outputs.upload_url }} bindist-thin: name: Binary distribution (thin) @@ -46,6 +60,7 @@ jobs: uses: ./.github/workflows/bindist-thin.yml with: release-version: ${{ needs.version.outputs.release-version }} + upload-url: ${{ needs.version.outputs.upload-url }} secrets: inherit bindist-full: @@ -54,6 +69,7 @@ jobs: uses: ./.github/workflows/bindist-full.yml with: release-version: ${{ needs.version.outputs.release-version }} + upload-url: ${{ needs.version.outputs.upload-url }} secrets: inherit move-tag: