Upload full source to release. #238
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Clone. | |
uses: actions/checkout@v2 | |
with: | |
submodules: recursive | |
- name: Install prerequisites. | |
run: | | |
pip install git-archive-all | |
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: Get release ID by tag. | |
id: get_release | |
if: github.event_name == 'workflow_dispatch' | |
uses: cardinalby/git-get-release-action@master | |
with: | |
tag: ${{ github.event.inputs.release_version }} | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set upload URL for release event. | |
id: set_upload_url | |
if: github.event_name == 'release' | |
run: | | |
echo "upload_url=${{ github.event.release.upload_url }}" >> $GITHUB_OUTPUT | |
- name: Upload. | |
uses: lovasoa/upload-release-asset@master | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.get_release.outputs.upload_url || steps.set_upload_url.outputs.upload_url }} | |
asset_path: ./dist/${{ env.TAG }} | |
asset_label: Source code (tar.gz, full) | |
asset_name: ${{ env.TAG }} | |
asset_content_type: application/x-gzip |