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 create releases on merges to main #4

Merged
merged 1 commit into from
Dec 18, 2024
Merged
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
67 changes: 67 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Create Release on PR merge

on:
pull_request:
types: [closed]
branches:
- main

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Git
uses: actions/setup-python@v5
with:
python-version: 3.x

- name: Get the latest tag and increment version
id: version
run: |
# Get the latest tag and strip the 'v' from the version
latest_tag=$(git describe --tags --abbrev=0)
# If no tag exists, start from v1.0
if [[ -z "$latest_tag" ]]; then
latest_tag="v1.0"
fi
# Increment the version (e.g., v1.1 -> v1.2)
version_number=$(echo "$latest_tag" | sed 's/^v//')
version_array=(${version_number//./ })
major=${version_array[0]}
minor=${version_array[1]}

# Increment minor version by 1
minor=$((minor + 1))

# Ensure the version is in the form v1.x
new_version="v$major.$minor"

echo "New version: $new_version"
echo "::set-output name=version::$new_version"

- name: Create release files
run: |
version="${{ steps.version.outputs.version }}"
# Make sure the config folder is in the tar and zip files
mkdir -p release
cp -r config/nvim release/

# Create tar.gz file
tar -czf "release/$version.tar.gz" -C release .

# Create zip file
zip -r "release/$version.zip" release

- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
files: release/*.tar.gz,release/*.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Clean up
run: |
rm -rf release
Loading