diff --git a/.github/workflows/nightly.yml b/.github/workflows/pre-release.yml similarity index 55% rename from .github/workflows/nightly.yml rename to .github/workflows/pre-release.yml index daf7a6a4c..707fe5206 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/pre-release.yml @@ -1,6 +1,9 @@ -name: Nightly Release +name: Pre-Release on: + push: + tags: + - 'v*-rc.*' schedule: - cron: 13 3 * * * workflow_dispatch: @@ -28,41 +31,41 @@ jobs: - name: Checkout code uses: actions/checkout@v3 - - name: Get submodules hash - id: submodules - run: | - echo "hash=$(git submodule status | awk '{print $1}' | sort | shasum -a 256 | sed 's/[ -]*//g')" >> $GITHUB_OUTPUT - - - name: Cache submodules - uses: actions/cache@v3 - with: - path: | - vendor/ - .git/modules - key: ${{ runner.os }}-${{matrix.arch}}-submodules-${{ steps.submodules.outputs.hash }} - - - name: prep variables id: vars run: | + ARCH=${{matrix.arch}} EXPERIMENTAL=$([[ "${{ matrix.experimental }}" == "true" ]] && echo "-experimental" || echo "") + TAG=$([[ "${{github.ref}}" == "refs/heads/master" ]] && echo "${{env.RELEASE_NAME}}" || echo ${{github.ref}} | sed 's#refs/tags/##') + echo "arch=${ARCH}" >> $GITHUB_OUTPUT echo "experimental=${EXPERIMENTAL}" >> $GITHUB_OUTPUT - NWAKU_ARTIFACT_NAME=$(echo "nwaku${EXPERIMENTAL}-${{matrix.arch}}-${{runner.os}}.tar.gz" | tr "[:upper:]" "[:lower:]") - NWAKU_TOOLS_ARTIFACT_NAME=$(echo "nwaku-tools${EXPERIMENTAL}-${{matrix.arch}}-${{runner.os}}.tar.gz" | tr "[:upper:]" "[:lower:]") + NWAKU_ARTIFACT_NAME=$(echo "nwaku${EXPERIMENTAL}-${ARCH}-${{runner.os}}-${TAG}.tar.gz" | tr "[:upper:]" "[:lower:]") + NWAKU_TOOLS_ARTIFACT_NAME=$(echo "nwaku-tools${EXPERIMENTAL}-${ARCH}-${{runner.os}}-${TAG}.tar.gz" | tr "[:upper:]" "[:lower:]") echo "nwaku=${NWAKU_ARTIFACT_NAME}" >> $GITHUB_OUTPUT echo "nwakutools=${NWAKU_TOOLS_ARTIFACT_NAME}" >> $GITHUB_OUTPUT + - name: build artifacts id: build run: | OS=$([[ "${{runner.os}}" == "macOS" ]] && echo "macosx" || echo "linux") - make QUICK_AND_DIRTY_COMPILER=1 V=1 CI=false EXPERIMENTAL=${{matrix.experimental}} NIMFLAGS="-d:disableMarchNative --os:${OS} --cpu:${{matrix.arch}}" wakunode2 tools + make QUICK_AND_DIRTY_COMPILER=1 V=1 CI=false EXPERIMENTAL=${{matrix.experimental}} NIMFLAGS="-d:disableMarchNative --os:${OS} --cpu:${{matrix.arch}}" \ + update - tar -cvzf ${{steps.vars.outputs.nwaku}} ./build/wakunode2 + make QUICK_AND_DIRTY_COMPILER=1 V=1 CI=false EXPERIMENTAL=${{matrix.experimental}} NIMFLAGS="-d:disableMarchNative --os:${OS} --cpu:${{matrix.arch}}" \ + wakunode2\ + chat2\ + tools + + make QUICK_AND_DIRTY_COMPILER=1 V=1 CI=false NIMFLAGS="-d:disableMarchNative --os:${OS} --cpu:${{matrix.arch}}" \ + wakunode1 + + + tar -cvzf ${{steps.vars.outputs.nwaku}} ./build/wakunode1 ./build/wakunode2 ./build/chat2 tar -cvzf ${{steps.vars.outputs.nwakutools}} ./build/wakucanary ./build/networkmonitor - name: upload artifacts @@ -88,15 +91,29 @@ jobs: with: fetch-depth: 0 ref: master + - name: download artifacts uses: actions/download-artifact@v2 + + - name: prep variables + id: vars + run: | + RELEASE=$([[ "${{github.ref}}" == "refs/heads/master" ]] && echo "${{env.RELEASE_NAME}}" || echo ${{github.ref}} | sed 's#refs/tags/##') + REF=$(echo ${{github.ref}} | sed 's#.*/##') + + echo "release=${RELEASE}" >> $GITHUB_OUTPUT + echo "ref=${REF}" >> $GITHUB_OUTPUT + - name: generate release notes env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - gh release view ${RELEASE_NAME} &>/dev/null &&\ - gh release delete -y ${RELEASE_NAME} --cleanup-tag &&\ - git tag -d ${RELEASE_NAME} + set -x + gh release view ${{steps.vars.outputs.release}} &>/dev/null &&\ + gh release delete -y ${{steps.vars.outputs.release}} &&\ + [[ "${{steps.vars.outputs.release}}" == "nightly" ]] && git tag -d ${{steps.vars.outputs.release}} + + RELEASE_NOTES_TAG=$([[ "${{steps.vars.outputs.release}}" != "nightly" ]] && echo "-t ${{steps.vars.outputs.ref}}" || echo "") docker run \ -t \ @@ -104,13 +121,15 @@ jobs: -v ${PWD}:/opt/sv4git/repo:z \ -u $(id -u) \ docker.io/wakuorg/sv4git:latest \ - release-notes |\ + release-notes ${RELEASE_NOTES_TAG} --previous $(git tag -l --sort -creatordate | grep -e "^v[0-9]*\.[0-9]*\.[0-9]*$") |\ sed -E 's@#([0-9]+)@[#\1](https://github.com/waku-org/nwaku/issues/\1)@g' > release_notes.md sed -i "s/^## .*/Generated at $(date)/" release_notes.md cat release_notes.md - gh release create ${RELEASE_NAME} --prerelease --target master \ - --title ${RELEASE_NAME} --notes-file release_notes.md \ + TARGET=$([[ "${{steps.vars.outputs.release}}" == "nightly" ]] && echo "--target ${{steps.vars.outputs.ref}}" || echo "") + + gh release create ${{steps.vars.outputs.release}} --prerelease ${TARGET} \ + --title ${{steps.vars.outputs.release}} --notes-file release_notes.md \ wakunode2/* tools/* diff --git a/.sv4git.yml b/.sv4git.yml index 325d9204a..8975e69fa 100644 --- a/.sv4git.yml +++ b/.sv4git.yml @@ -2,6 +2,7 @@ version: "1.1" #config version tag: pattern: "v%d.%d.%d" + filter: "v*" release-notes: sections: # Array with each section of release note. Check template section for more information. diff --git a/docs/contributors/release-process.md b/docs/contributors/release-process.md index f275c863e..272b67076 100644 --- a/docs/contributors/release-process.md +++ b/docs/contributors/release-process.md @@ -22,39 +22,51 @@ Ensure all items in this list are ticked: 1. Checkout a release branch from master -`git checkout -b release/v0.1` + ``` + git checkout -b release/v0.1.0 + ``` -2. Update `CHANGELOG.md` and ensure it is up to date +1. Update `CHANGELOG.md` and ensure it is up to date. Use the helper Make target to get PR based release-notes/changelog update. -3. Create a tag with the same name as release and push it + ``` + make release-notes + ``` -``` -git tag -as v0.1 -m "Initial release." -git push origin v0.1 -``` +1. Create a release-candidate tag with the same name as release and `-rc.N` suffix a few days before the official release and push it -4. Open a PR + ``` + git tag -as v0.1.0-rc.0 -m "Initial release." + git push origin v0.1.0-rc.0 + ``` -5. Harden release in release branch - - Create a [Github release](https://github.com/waku-org/nwaku/releases) on the release tag. - - Add binaries for `macos` and `ubuntu` as release assets. Binaries can be compiled by triggering the ["Upload Release Asset"](https://github.com/waku-org/nwaku/actions/workflows/release-assets.yml) workflow. Where possible, test the binaries before uploading to the release. + This will trigger a [workflow](../../.github/workflows/pre-release.yml) which will build RC artifacts and create and publish a Github release -6. Modify tag +1. Open a PR from the release branch for others to review the included changes and the release-notes -If you need to update stuff, remove tag and make sure the new tag is associated -with CHANGELOG update. +1. In case additional changes are needed, create a new RC tag -``` -# Delete tag -git tag -d v0.1 -git push --delete origin v0.1 + Make sure the new tag is associated + with CHANGELOG update. -# Make changes, rebase and tag again -# Squash to one commit and make a nice commit message -git rebase -i origin/master -git tag -as v0.1 -m "Initial release." -git push origin v0.1 -``` + ``` + # Make changes, rebase and create new tag + # Squash to one commit and make a nice commit message + git rebase -i origin/master + git tag -as v0.1.0-rc.1 -m "Initial release." + git push origin v0.1.0-rc.1 + ``` + +1. Once the release-candidate has been validated, create a final release tag and push it. + + ``` + git checkout release/v0.1.0 + git tag -as v0.1.0 -m "Initial release." + git push origin v0.1.0 + ``` + +1. Create a [Github release](https://github.com/waku-org/nwaku/releases) from the release tag. + + * Add binaries produced by the ["Upload Release Asset"](https://github.com/waku-org/nwaku/actions/workflows/release-assets.yml) workflow. Where possible, test the binaries before uploading to the release. ### After the release