diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 751599ced..103c443b8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -75,15 +75,28 @@ jobs: id: release_name uses: actions/github-script@v4 with: - script: | - const branch_name = process.env.GITHUB_REF - const web3j_release_version = branch_name.substring(branch_name.lastIndexOf('/') +1 ,branch_name.length ) - return web3j_release_version + result-encoding: string + script: | + const branch_name = process.env.GITHUB_REF + const web3j_release_version = branch_name.substring(branch_name.lastIndexOf('/') +1 ,branch_name.length ) + return web3j_release_version + outputs: + stripped_version: ${{ steps.release_name.outputs.result }} - name: Build and stage release run: ./gradlew publish -Pversion=${{ steps.release_name.outputs.result }} - name: Release run: ./gradlew closeAndReleaseRepository - - name: GitHub release - run: ./scripts/github-release.sh - name: Javadoc release run: ./gradlew -Dorg.ajoberstar.grgit.auth.username=${{ secrets.GITHUB_TOKEN }} core:gitPublishPush + git-release: + needs: release + runs-on: ubuntu-latest + steps: + - name: Github Release + uses: marvinpinto/action-automatic-releases@latest + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + automatic_release_tag: 'v${{ needs.release.outputs.stripped_version }}' + prerelease: false + files: | + "web3j-"+${{ steps.release_name.outputs.result }}.* \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index e00feaafa..000000000 --- a/.travis.yml +++ /dev/null @@ -1,48 +0,0 @@ -language: java -jdk: - - openjdk8 -sudo: false -before_cache: - - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock - - rm -fr $HOME/.gradle/caches/*/plugin-resolution/ -cache: - directories: - - "$HOME/.gradle/caches/" - - "$HOME/.gradle/wrapper/" -install: skip -test: skip -jobs: - include: - - stage: build pull request - script: "./gradlew check jacocoTestReport" - if: type = pull_request - - stage: build master - script: "./gradlew check jacocoTestReport publish" - if: branch = master AND NOT type = pull_request - - stage: build and stage release - if: branch =~ /release/ - script: "./gradlew check publish bintrayUpload -Pversion=${TRAVIS_BRANCH#'release/'}" - - stage: release - if: branch =~ /release/ - script: "./gradlew closeAndReleaseRepository" - - stage: github release - if: branch =~ /release/ - script: "./scripts/github-release.sh" - - stage: javadoc release - if: branch =~ /release/ - script: "./gradlew -Dorg.ajoberstar.grgit.auth.username=$GITHUB_PERSONAL_ACCESS_TOKEN core:gitPublishPush" -after_success: - - bash <(curl -s https://codecov.io/bash) -before_install: - - | - if [[ "$TRAVIS_PULL_REQUEST" = "false" ]]; then - openssl aes-256-cbc -K $encrypted_661235106ac6_key -iv $encrypted_661235106ac6_iv -in web3j.asc.enc -out web3j.asc -d - fi -env: - global: - - secure: bMq4UDE/u66XSRv3gSAP/p36RMHFuk1lDk+HpDFw6HPJNzSNU4PHJZrzzr3cvkea6GF7lCutKG//bzeQkgsHesj27WNmj9PRWZYVfdhpRADm8kwBwaK/lRN9JIQOpZ5D1NTIecOL/iPMNU3FXQ7UVTLUx3EbrY9CpNKIFB/n9jTUjJgS1nlr5ysMfaQ9SfcFnJ4r87o9oeyiAczE74laD1hzVYDkiNUOkbdruxv6ewQqJJYEQWzjNyHjbTFjxiGQq8WdPLgu0FpVDSzGfB9h+BdpAqNvP7xfko4hTKHofLkhDClcolWSPzIaCS/09hdJdsrNyBRFpEB37nF3PLNfmfIYjXVWtRU0Xz/Ti77Bqr7C/3N+13LRrn8uLSf/yF0PByFAiaEj7RMQfpkJTmtCe7Y3JPD1PmGrUSGCVWWWR6wgle9P66lEiBqHsNvx7uYJkdnjcfbUwJaXqPHjHnYeOU3sKYWSuMjz4XSDBnRVQNkmzF554UnWmzGh48vva6hDMRrYiGc5eN0BYvFQTm5slTvIM4ilnEQQDtfWfgBCrSns+lAP1ky8E7BCoH9VCx5w9ljYjENcrc07LzWICwHSUPsjoJGvd9nJNspPdThInpqsH5izlW8kJzBCjoFuCdmQfy4xAYCqz3OvYPDHF2lCX81AFwoGqJbpzNlfgreK0I8= - - secure: hrg/9OT9ncR1EJRqMyUoLvFTWQZmaN91EupqUzzJRaqZEtHoSbZviJvDdNXItMWNcUjLS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wtq6j6mSVjQu/2ZyP+0Uy6F5GIA2Llh3gFWK/cT0JSrU3X9jiNz3iuHqiWST6/4R2QS1Nr44TArh2cAcDiBs7eaoVkbqaV11ZGR4BR9dvaOXj2WRzYrSsqisSL08WVZA2Ks= diff --git a/scripts/common.bash b/scripts/common.bash deleted file mode 100755 index 9716f298c..000000000 --- a/scripts/common.bash +++ /dev/null @@ -1,35 +0,0 @@ -set -eo pipefail - -[[ "$TRACE" ]] && set -x - -configure_github_user() { - git config --global user.email "git@antonydenyer.co.uk" - git config --global user.name "Antony Denyer" -} - -github_clone() { - git clone https://antonydenyer:${GITHUB_TOKEN}@github.com/web3j/$1.git - cd $1 -} - -ensure_version() { - if [[ -z "$VERSION" ]]; then - VERSION="${TRAVIS_BRANCH//release\/}" - fi - - if [[ "$VERSION" = "" ]]; then - echo "ERROR: Missing VERSION specify it using an env variable" - exit 1 - fi -} - -ensure_product() { - if [[ -z "$PRODUCT" ]]; then - PRODUCT="${TRAVIS_REPO_SLUG//web3j\/}" - fi - - if [[ "$PRODUCT" = "" ]]; then - echo "ERROR: Missing PRODUCT specify it using an env variable" - exit 1 - fi -} diff --git a/scripts/github-release.sh b/scripts/github-release.sh deleted file mode 100755 index f4fa497f3..000000000 --- a/scripts/github-release.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash - -set -eo pipefail - -SOURCE="${BASH_SOURCE[0]}" -while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink - DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" - SOURCE="$(readlink "$SOURCE")" - [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located -done - -trap 'last_command=$current_command; current_command=$BASH_COMMAND' DEBUG -# echo an error message before exiting -trap 'echo "\"${last_command}\" command filed with exit code $?."' EXIT - -export SCRIPTS_DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" - -source "$SCRIPTS_DIR/common.bash" - -ensure_version - -ensure_product - -export PREVIOUS_RELEASE=$(curl -H "Authorization: token ${GITHUB_TOKEN}" -s https://api.github.com/repos/web3j/${PRODUCT}/releases/latest | jq -r '.target_commitish' ) -export CHANGELOG=$(git rev-list --format=oneline --abbrev-commit --max-count=50 ${PREVIOUS_RELEASE}..HEAD | jq --slurp --raw-input . ) - -echo "Creating a new release on GitHub with changes" -echo -e "\n${CHANGELOG:1:-1}" - -API_JSON="{ - \"tag_name\": \"v${VERSION}\", - \"target_commitish\": \"$(git rev-parse HEAD)\", - \"name\": \"v${VERSION}\", - \"body\": \"Release of version ${VERSION}: \n\n ${CHANGELOG:1:-1}\", - \"draft\": false, - \"prerelease\": false -}" - - -export RESULT=$(curl -H "Authorization: token ${GITHUB_TOKEN}" --data "$API_JSON" -s https://api.github.com/repos/web3j/${PRODUCT}/releases) -export UPLOAD_URL=$(echo ${RESULT} | jq -r ".upload_url") - -for FILE in `find ./ -type f -name "${PRODUCT}-${VERSION}.*"`; -do - curl -H "Authorization: token ${GITHUB_TOKEN}" -s "${UPLOAD_URL:0:-13}?name=$(basename -- $FILE)" -H "Content-Type: $(file -b --mime-type $FILE)" --data-binary @"${FILE}" -done - -echo "Release finished" \ No newline at end of file