Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Github action to upload complete tarball #1112

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions .github/workflows/create_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Create Release

on:
push:
tags: ['v*']
branches: [master]
release:
types: [published]
pull_request:
paths: [.github/workflows/create_release.yml]

jobs:
release:
name: Create Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: Fake name for PRs
if: ${{ github.event_name == 'pull_request' }}
run: echo "GITHUB_REF=refs/tags/pr-tag" >> "$GITHUB_ENV"
- name: Real name for non-PRs
if: ${{ github.event_name != 'pull_request' }}
run: echo "GITHUB_REF=$GITHUB_REF" >> "$GITHUB_ENV"
- name: Set filenames
run: |
tag_or_branch="${GITHUB_REF#refs/tags/}"
tag_or_branch="${tag_or_branch#refs/heads/}"
echo "RELEASE_NAME=VVVVVV-$tag_or_branch" >> "$GITHUB_ENV"
echo "RELEASE_FILE=VVVVVV-$tag_or_branch.tar.gz" >> "$GITHUB_ENV"
- name: Create source distribution
run: |
# Create new folder with specified name so extracting the archive yields that
rm -rf "/tmp/$RELEASE_NAME"
cp -r "$PWD" "/tmp/$RELEASE_NAME"
mv "/tmp/$RELEASE_NAME" .
# Cleanup
find "$RELEASE_NAME" -name '.git*' -exec rm -rv {} \; || true
# Create archive
tar -czf "$RELEASE_FILE" "$RELEASE_NAME"
echo "Created source archive $RELEASE_FILE with content: $(ls -a "$RELEASE_NAME")"
- name: Upload source distribution
if: ${{ github.event_name == 'release' }}
uses: softprops/action-gh-release@v1
with:
files: ${{env.RELEASE_FILE}}

concurrency:
group: create-release-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
Loading