Fix package publishing #8
Workflow file for this run
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: Bump path version | |
on: | |
# push: | |
# branches: [main] | |
pull_request: | |
jobs: | |
bump-version: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
# packages: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
sparse-checkout: . | |
fetch-depth: 0 | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: npm | |
- name: 'Get last release' | |
run: | | |
COMMIT_NAME=$(git log -n 1 --pretty=format:%s) | |
LAST_RELEASE_VERSION=$(curl -L https://api.github.com/repos/$GITHUB_REPOSITORY/releases | jq -r '.|=sort_by(.name|ltrimstr("v")|split(".")|map(tonumber)|[.[0],.[1],-.[2]])|.[-1].name' | sed 's|v||') | |
echo "Last release version: ${LAST_RELEASE_VERSION}" | |
MAIN_COMMIT=$(git rev-parse origin/main) | |
echo "Main commit: ${MAIN_COMMIT}" | |
LAST_RELEASE_BRANCH="release-${LAST_RELEASE_VERSION}" | |
LAST_RELEASE_COMMIT=$(git rev-parse "origin/main") | |
echo "Last release commit: ${LAST_RELEASE_COMMIT}" | |
if [ "$MAIN_COMMIT" = "$LAST_RELEASE_COMMIT" ]; then echo "Hash commit in main branch matches the last release branch commit" && exit 1; fi | |
echo "COMMIT_NAME=$COMMIT_NAME" >> "$GITHUB_ENV" | |
echo "LAST_RELEASE_VERSION=$LAST_RELEASE_VERSION" >> "$GITHUB_ENV" | |
# - name: Git user configuration | |
# run: | | |
# git config user.email "[email protected]" | |
# git config user.name "Datalens-tech robot" | |
# - name: Bump the version | |
# run: npm version patch -m 'bump version to %s' | |
# - name: Push changes | |
# run: git push | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |