Explorar el Código

Version bump script (#1010)

Tom Linton hace 3 años
padre
commit
4ba09fb1e5
Se han modificado 3 ficheros con 43 adiciones y 2 borrados
  1. 2 2
      .travis.yml
  2. 1 0
      VERSION
  3. 40 0
      version-bump.sh

+ 2 - 2
.travis.yml

@@ -22,8 +22,8 @@ _tests: &tests
   before_install:
   - nvm install $NODE_VERSION
   - cd ts && yarn && yarn build && yarn link && cd ../
-  - cd examples/tutorial && yarn && yarn link @project-serum/anchor && cd ../../
-  - cd tests && yarn && yarn link @project-serum/anchor && cd ..
+  - cd examples/tutorial && yarn link @project-serum/anchor && yarn && cd ../../
+  - cd tests && yarn link @project-serum/anchor && yarn && cd ..
   - sudo apt-get install -y pkg-config build-essential libudev-dev
   - sh -c "$(curl -sSfL https://release.solana.com/v${SOLANA_CLI_VERSION}/install)"
   - export PATH="/home/travis/.local/share/solana/install/active_release/bin:$PATH"

+ 1 - 0
VERSION

@@ -0,0 +1 @@
+0.18.0

+ 40 - 0
version-bump.sh

@@ -0,0 +1,40 @@
+#!/bin/bash
+
+set -e
+
+if [ $# -eq 0 ]; then
+    echo "Usage $0 VERSION"
+    exit 1
+fi
+
+echo "Bumping versions to $1"
+
+# GNU/BSD compat
+sedi=(-i)
+case "$(uname)" in
+  # For macOS, use two parameters
+  Darwin*) sedi=(-i "")
+esac
+
+git grep -l $(cat VERSION) -- ':!**/yarn.lock' ':!CHANGELOG.md' ':!Cargo.lock' ':!package.json' | \
+    xargs sed "${sedi[@]}" \
+    -e "s/$(cat VERSION)/$1/g"
+
+# Potential for collisions in package.json files, handle those separately
+# Replace only matching "version": "x.xx.x" and "@project-serum/anchor": "x.xx.x"
+git grep -l $(cat VERSION) -- '**/package.json' | \
+    xargs sed "${sedi[@]}" \
+    -e "s/@project-serum\/anchor\": \"$(cat VERSION)\"/@project-serum\/anchor\": \"$1\"/g" \
+    -e "s/\"version\": \"$(cat VERSION)\"/\"version\": \"$1\"/g"
+
+# Potential for collisions in Cargo.lock, use cargo update to update it
+cargo update --workspace
+
+# Insert version number into CHANGELOG.md
+sed "${sedi[@]}" -e "s/## \[Unreleased\]/## [Unreleased]\n\n## [$1] - $(date '+%Y-%m-%d')/g" CHANGELOG.md
+
+echo $1 > VERSION
+
+echo "$(git diff --stat | tail -n1) files modified"
+
+echo " $(cat VERSION) changeset generated, commit and tag"