need to update the gh release create command to add a body. otherwise… #22
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 Arrow Files to Latest Release | |
on: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
jobs: | |
upload-arrow-files: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
- name: Check if Arrow files are modified | |
id: arrow_files_modified | |
run: | | |
# List modified files in the PR | |
modified_files=$(git diff --name-only HEAD~1 HEAD) | |
echo "Modified files: $modified_files" | |
# Check if any Arrow files were modified (based on their file extension or path) | |
if echo "$modified_files" | grep -qE "\.arrow$"; then | |
echo "Arrow files were modified." | |
echo "arrow_files_modified=true" >> $GITHUB_ENV | |
else | |
echo "No Arrow files were modified." | |
echo "arrow_files_modified=false" >> $GITHUB_ENV | |
fi | |
- name: Pull Git LFS Files | |
if: env.arrow_files_modified == 'true' | |
run: | | |
# git lfs install | |
git lfs pull | |
- name: Get Incremented EJAMDATA Release Tag | |
if: env.arrow_files_modified == 'true' | |
run: | | |
# Get the latest release tag from the current repo | |
latest_tag=$(curl -s https://api.github.com/repos/${{ github.repository }}/releases/latest | jq -r .tag_name) | |
# If no release exists, start with v0.1.0 | |
if [ "$latest_tag" == "null" ]; then | |
new_ejamdata_tag="v0.1.0" | |
else | |
# Increment the version (Assuming version format is like v1.2.3) | |
new_ejamdata_tag=$(echo "$latest_tag" | awk -F. -v OFS=. '{ $NF++; print $0 }') | |
fi | |
echo "new_tag=$new_ejamdata_tag" >> $GITHUB_ENV | |
echo "latest_tag=$latest_tag" >> $GITHUB_ENV | |
- name: Update Latest Release with New Arrow Files | |
if: env.arrow_files_modified == 'true' | |
env: | |
GH_TOKEN: ${{ github.token }} | |
run: | | |
gh release create ${{ env.new_tag }} ./data/*.arrow --title "${{ env.new_tag }}" --notes "latest release" | |
gh release delete ${{ env.latest_tag }} --yes | |