Skip to content

0.2.1

0.2.1 #5

Workflow file for this run

name: Create Release
# Based on https://github.com/pytorch/pytorch/blob/main/.github/workflows/create_release.yml
on:
release:
types: [published]
jobs:
release:
name: Create Release
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Set git to use LF
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- name: Check out the repository under $GITHUB_WORKSPACE
uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: Fake name for PRs
if: ${{ github.event_name == 'pull_request' }}
run: echo "REPO_GITHUB_REF=refs/tags/pr-tag" >> "$GITHUB_ENV"
- name: Real name for non-PRs
if: ${{ github.event_name != 'pull_request' }}
run: echo "REPO_GITHUB_REF=$GITHUB_REF" >> "$GITHUB_ENV"
- name: Set filenames
run: |
tag_or_branch="${REPO_GITHUB_REF#refs/tags/}"
tag_or_branch="${tag_or_branch#refs/heads/}"
# replace directory separators with _ in branch name
tag_or_branch="${tag_or_branch//\//_}"
echo "REPO_RELEASE_NAME=reproa-$tag_or_branch" >> "$GITHUB_ENV"
echo "REPO_RELEASE_FILE=reproa-$tag_or_branch.tar.gz" >> "$GITHUB_ENV"
- name: Create source distribution
run: |
# Create a new folder with a specified name so that extracting the archive yields that
rm -rf "/tmp/$REPO_RELEASE_NAME"
cp -r "$PWD" "/tmp/$REPO_RELEASE_NAME"
mv "/tmp/$REPO_RELEASE_NAME" .
# Cleanup
rm -rf "$REPO_RELEASE_NAME"/{.circleci,.ci}
find "$REPO_RELEASE_NAME" -name '.git*' -exec rm -rv {} \; || true
# Create archive
tar -czf "$REPO_RELEASE_FILE" "$REPO_RELEASE_NAME"
echo "Created source archive $REPO_RELEASE_FILE with content: $(ls -a "$REPO_RELEASE_NAME")"
- name: Upload source distribution
if: ${{ github.event_name == 'release' }}
uses: softprops/action-gh-release@v1
with:
files: ${{env.REPO_RELEASE_FILE}}
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}-${{ github.event_name }}
cancel-in-progress: true