diff --git a/.github/workflows/publish_release.yml b/.github/workflows/publish_release.yml new file mode 100644 index 0000000..75fec05 --- /dev/null +++ b/.github/workflows/publish_release.yml @@ -0,0 +1,59 @@ +name: "publish-release" + +on: + push: + branches: + - "main" + +jobs: + npm-publish: + name: "Publish" + runs-on: ubuntu-latest + defaults: + run: + shell: bash + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + ### Calculate FINAL_VERSION + - name: Install jq + run: sudo apt-get update && sudo apt-get --yes --force-yes install jq + + - name: Get version from npm and increment + run: | + yarn global add semver + PATH="$(yarn global bin):$PATH" + LOCAL_VERSION="$(cat package.json | jq .version)" + PKG_NAME="$(cat package.json | jq .name)" + NPM_VERSION="$(yarn info --silent "$PKG_NAME" version || true)" + MAX_VERSION="$(semver "$LOCAL_VERSION" "$NPM_VERSION" "0.0.0" | tail -n1)" + FINAL_VERSION="$(semver --increment patch "$MAX_VERSION")" + echo "FINAL_VERSION=$FINAL_VERSION" | tee -a $GITHUB_ENV + + ### Set version + - name: Set version to ${{ env.FINAL_VERSION }} + run: yarn version --new-version ${{ env.FINAL_VERSION }} --no-git-tag-version + + ### Publish to NPM + - uses: JS-DevTools/npm-publish@v1 + with: + package: package.json + access: public + check-version: false + token: ${{ secrets.NPM_TOKEN }} + + ### Create a pre-release + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ env.FINAL_VERSION }} + release_name: Fluence Network ${{ env.FINAL_VERSION }} + body: | + ${{ steps.publish.outputs }} + draft: true +# prerelease: false \ No newline at end of file diff --git a/README.md b/README.md index e096d34..bf96ce2 100644 --- a/README.md +++ b/README.md @@ -1,3 +1 @@ # Fluence network environment - -TDB diff --git a/package.json b/package.json index ef03b69..eb141af 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { - "name": "fluence-network-environment", - "version": "0.1.0", - "description": "the browser js-libp2p client for the Fluence network", + "name": "@fluencelabs/fluence-network-environment", + "version": "1.0.0", + "description": "Fluence network environments addresses", "main": "./dist/index.js", "typings": "./dist/index.d.ts", "scripts": { @@ -13,5 +13,6 @@ "dependencies": {}, "devDependencies": { "typescript": "3.9.5" - } + }, + "private": false }