mirror of
				https://code.forgejo.org/actions/forgejo-release.git
				synced 2025-11-04 06:41:57 +02:00 
			
		
		
		
	override an existing release by the same tag
This commit is contained in:
		
							parent
							
								
									888150209e
								
							
						
					
					
						commit
						809ad6c4e5
					
				
					 4 changed files with 27 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -22,6 +22,7 @@ Upload or download the assets of a release to a Forgejo instance.
 | 
			
		|||
| gpg-passphrase | Passphrase of the GPG Private Key | `false` |  |
 | 
			
		||||
| download-retry | Number of times to retry if the release is not ready (default 1) | `false` |  |
 | 
			
		||||
| verbose | Increase the verbosity level | `false` | false |
 | 
			
		||||
| override | Override an existing release by the same {tag} | `false` | false |
 | 
			
		||||
| prerelease | Mark Release as Pre-Release | `false` | false |
 | 
			
		||||
<!-- action-docs-inputs -->
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -32,6 +32,9 @@ inputs:
 | 
			
		|||
  verbose:
 | 
			
		||||
    description: 'Increase the verbosity level'
 | 
			
		||||
    default: 'false'
 | 
			
		||||
  override:
 | 
			
		||||
    description: 'Override an existing release by the same {tag}'
 | 
			
		||||
    default: 'false'
 | 
			
		||||
  prerelease:
 | 
			
		||||
    description: 'Mark Release as Pre-Release'
 | 
			
		||||
    default: 'false'
 | 
			
		||||
| 
						 | 
				
			
			@ -76,6 +79,8 @@ runs:
 | 
			
		|||
          export SHA="${{ github.sha }}"
 | 
			
		||||
        fi
 | 
			
		||||
 | 
			
		||||
        export OVERRIDE="${{ inputs.override }}"
 | 
			
		||||
 | 
			
		||||
        export VERBOSE="${{ inputs.verbose }}"
 | 
			
		||||
 | 
			
		||||
        export RETRY="${{ inputs.download-retry }}"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -12,6 +12,7 @@ if ${VERBOSE:-false}; then set -x; fi
 | 
			
		|||
: ${GNUPGHOME:=$TMP_DIR}
 | 
			
		||||
: ${BIN_DIR:=$TMP_DIR}
 | 
			
		||||
: ${TEA_VERSION:=0.9.0}
 | 
			
		||||
: ${OVERRIDE:=false}
 | 
			
		||||
: ${RETRY:=1}
 | 
			
		||||
: ${DELAY:=10}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -84,12 +85,21 @@ maybe_sign_release() {
 | 
			
		|||
    fi
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
maybe_override() {
 | 
			
		||||
    if test "$OVERRIDE" = "false"; then
 | 
			
		||||
	return
 | 
			
		||||
    fi
 | 
			
		||||
    api DELETE repos/$REPO/releases/tags/$TAG >& /dev/null || true
 | 
			
		||||
    api DELETE repos/$REPO/tags/$TAG >& /dev/null || true
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
upload() {
 | 
			
		||||
    setup_api
 | 
			
		||||
    setup_tea
 | 
			
		||||
    rm -f ~/.config/tea/config.yml
 | 
			
		||||
    GITEA_SERVER_TOKEN=$TOKEN $BIN_DIR/tea login add --url $FORGEJO
 | 
			
		||||
    maybe_sign_release
 | 
			
		||||
    maybe_override
 | 
			
		||||
    upload_release
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,6 +17,17 @@ jobs:
 | 
			
		|||
          release-dir: upload-dir
 | 
			
		||||
          release-notes: "RELEASE NOTES"
 | 
			
		||||
          verbose: true
 | 
			
		||||
      - if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
 | 
			
		||||
        id: release-upload
 | 
			
		||||
        uses: SELF@vTest
 | 
			
		||||
        with:
 | 
			
		||||
          direction: upload
 | 
			
		||||
          tag: v1.0
 | 
			
		||||
          token: FORGEJO_TOKEN
 | 
			
		||||
          release-dir: upload-dir
 | 
			
		||||
          release-notes: "RELEASE NOTES"
 | 
			
		||||
          override: "true"
 | 
			
		||||
          verbose: true
 | 
			
		||||
      - if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
 | 
			
		||||
        id: release-download
 | 
			
		||||
        uses: SELF@vTest
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue