diff --git a/.github/workflows/full_source.yml b/.github/workflows/full_source.yml index a0cd92ffb4537..e6695cd8a3a81 100644 --- a/.github/workflows/full_source.yml +++ b/.github/workflows/full_source.yml @@ -3,6 +3,12 @@ name: Upload full source to release. on: release: types: released + workflow_dispatch: + inputs: + release_version: + description: 'The version of the release to upload' + required: true + default: 'v1.0.0' jobs: build: @@ -16,19 +22,31 @@ jobs: run: | pip install git-archive-all - p=$(echo frk-v${GITHUB_REF##*/v}-full.tar.gz) + if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then + # Use the release version from the input if available. + p="frk-${{ github.event.inputs.release_version }}-full.tar.gz" + else + # Otherwise fallback to the release event. + p="frk-v${GITHUB_REF##*/v}-full.tar.gz" + fi echo "TAG=$p" >> $GITHUB_ENV - name: Build assets. run: | mkdir -p dist/ echo "$TAG" ~/.local/bin/git-archive-all ./dist/${TAG} + - name: Set upload URL. + run: | + REPO="${{ github.repository }}" + FILE_PATH="${{ env.TAG }}" + UPLOAD_URL="https://uploads.github.com/repos/$REPO/releases/${{ github.event.release.id }}/assets?name=$FILE_PATH" + echo "UPLOAD_URL=$UPLOAD_URL" >> $GITHUB_ENV - name: Upload. uses: lovasoa/upload-release-asset@master env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - upload_url: ${{ github.event.release.upload_url }} + upload_url: ${{ env.UPLOAD_URL }} asset_path: ./dist/${{ env.TAG }} asset_label: Source code (tar.gz, full) asset_name: ${{ env.TAG }}