Merge ade2c57f28 into c2e0608dc4
				
					
				
			This commit is contained in:
		
						commit
						9b0bb4d7d2
					
				@ -17,6 +17,7 @@ Optional Arguments
 | 
			
		||||
                This is not used if `file_glob` is set to `true`.
 | 
			
		||||
- `file_glob`: If set to true, the file argument can be a glob pattern (`asset_name` is ignored in this case) (Default: `false`)
 | 
			
		||||
- `overwrite`: If an asset with the same name already exists, overwrite it (Default: `false`).
 | 
			
		||||
- `duplicated_error`: If an asset with the same name already exists, throw error (Default: `true`).
 | 
			
		||||
- `prerelease`: Mark the release as a pre-release (Default: `false`).
 | 
			
		||||
- `release_name`: Explicitly set a release name. (Defaults: implicitly same as `tag` via GitHub API).
 | 
			
		||||
- `body`: Content of the release text (Default: `""`).
 | 
			
		||||
 | 
			
		||||
@ -19,7 +19,10 @@ inputs:
 | 
			
		||||
  asset_name:
 | 
			
		||||
    description: 'Name of the asset. When not provided will use the file name. Unused if file_glob is set to "true".'
 | 
			
		||||
  overwrite:
 | 
			
		||||
    description: 'Overwrite the release in case it already exists.'
 | 
			
		||||
    description: 'If an asset with the same name already exists, overwrite it.'
 | 
			
		||||
  duplicated_error:
 | 
			
		||||
    description: 'If an asset with the same name already exists, throw error.'
 | 
			
		||||
    default: "true"
 | 
			
		||||
  file_glob:
 | 
			
		||||
    description: 'If true the file can be a glob pattern, asset_name is ignored if this is true.'
 | 
			
		||||
  prerelease:
 | 
			
		||||
 | 
			
		||||
@ -53,6 +53,7 @@ async function upload_to_release(
 | 
			
		||||
  asset_name: string,
 | 
			
		||||
  tag: string,
 | 
			
		||||
  overwrite: boolean,
 | 
			
		||||
  duplicated_error: boolean,
 | 
			
		||||
  octokit: Octokit
 | 
			
		||||
): Promise<undefined | string> {
 | 
			
		||||
  const stat = fs.statSync(file)
 | 
			
		||||
@ -82,9 +83,14 @@ async function upload_to_release(
 | 
			
		||||
        asset_id: duplicate_asset.id
 | 
			
		||||
      })
 | 
			
		||||
    } else {
 | 
			
		||||
      if (duplicated_error) {
 | 
			
		||||
        core.setFailed(`An asset called ${asset_name} already exists.`)
 | 
			
		||||
        return duplicate_asset.browser_download_url
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      core.warn(`An asset called ${asset_name} already exists.`)
 | 
			
		||||
      return duplicate_asset.browser_download_url
 | 
			
		||||
    }
 | 
			
		||||
  } else {
 | 
			
		||||
    core.debug(
 | 
			
		||||
      `No pre-existing asset called ${asset_name} found in release ${tag}. All good.`
 | 
			
		||||
@ -137,6 +143,7 @@ async function run(): Promise<void> {
 | 
			
		||||
 | 
			
		||||
    const file_glob = core.getInput('file_glob') == 'true' ? true : false
 | 
			
		||||
    const overwrite = core.getInput('overwrite') == 'true' ? true : false
 | 
			
		||||
    const duplicated_error = core.getInput('duplicated_error') == 'true' ? true : false
 | 
			
		||||
    const prerelease = core.getInput('prerelease') == 'true' ? true : false
 | 
			
		||||
    const release_name = core.getInput('release_name')
 | 
			
		||||
    const body = core.getInput('body')
 | 
			
		||||
@ -161,6 +168,7 @@ async function run(): Promise<void> {
 | 
			
		||||
            asset_name,
 | 
			
		||||
            tag,
 | 
			
		||||
            overwrite,
 | 
			
		||||
            duplicated_error,
 | 
			
		||||
            octokit
 | 
			
		||||
          )
 | 
			
		||||
          core.setOutput('browser_download_url', asset_download_url)
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user