Fix: Daemon clipboard on linux (#11) #70
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: Auto Tag, Update Version, and Changelog | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
auto_tag_and_update: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Debug Info | |
run: | | |
echo "GitHub Ref: ${{ github.ref }}" | |
echo "GitHub Event Name: ${{ github.event_name }}" | |
echo "Last Commit Message:" | |
git log -1 --pretty=%B | |
echo "Changed files:" | |
git diff --name-only HEAD^ | |
- name: Get latest tag | |
id: get_latest_tag | |
run: | | |
git fetch --tags | |
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.1.0") | |
echo "LATEST_TAG=$LATEST_TAG" >> $GITHUB_OUTPUT | |
echo "Latest tag: $LATEST_TAG" | |
- name: Bump version | |
id: bump_version | |
run: | | |
LATEST_TAG=${{ steps.get_latest_tag.outputs.LATEST_TAG }} | |
LATEST_VERSION=${LATEST_TAG#v} | |
IFS='.' read -ra VERSION_PARTS <<< "$LATEST_VERSION" | |
MAJOR=${VERSION_PARTS[0]} | |
MINOR=${VERSION_PARTS[1]} | |
PATCH=${VERSION_PARTS[2]} | |
NEW_PATCH=$((PATCH + 1)) | |
NEW_VERSION="$MAJOR.$MINOR.$NEW_PATCH" | |
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_OUTPUT | |
echo "New version: $NEW_VERSION" | |
- name: Update Cargo.toml | |
run: | | |
sed -i 's/^version = ".*"/version = "${{ steps.bump_version.outputs.NEW_VERSION }}"/' Cargo.toml | |
echo "Updated Cargo.toml:" | |
grep version Cargo.toml | |
- name: Update Changelog | |
run: | | |
NEW_VERSION=${{ steps.bump_version.outputs.NEW_VERSION }} | |
TODAY=$(date +%Y-%m-%d) | |
# Check if CHANGELOG.md exists, create it if it doesn't | |
if [ ! -f CHANGELOG.md ]; then | |
echo "# Changelog" > CHANGELOG.md | |
echo "" >> CHANGELOG.md | |
fi | |
# Get all commit messages since the last tag | |
COMMITS=$(git log $(git describe --tags --abbrev=0)..HEAD --pretty=format:"- %s") | |
# Prepend new version section to CHANGELOG.md | |
sed -i "1i\\\n## [$NEW_VERSION] - $TODAY\n\n$COMMITS\n" CHANGELOG.md | |
echo "Updated CHANGELOG.md with new version $NEW_VERSION" | |
cat CHANGELOG.md | |
- name: Commit and push changes | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git add Cargo.toml CHANGELOG.md | |
git commit -m "Bump version to ${{ steps.bump_version.outputs.NEW_VERSION }} and update CHANGELOG.md" | |
git push | |
echo "Pushed changes to Cargo.toml and CHANGELOG.md" | |
echo "New git status:" | |
git status | |
- name: Create new tag | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
git tag -a v${{ steps.bump_version.outputs.NEW_VERSION }} -m "Release v${{ steps.bump_version.outputs.NEW_VERSION }}" | |
git push origin v${{ steps.bump_version.outputs.NEW_VERSION }} | |
echo "Created and pushed new tag: v${{ steps.bump_version.outputs.NEW_VERSION }}" | |
echo "All tags:" | |
git tag -l |