name: Pre-Release on: push: tags: - 'v*-rc.*' schedule: - cron: 13 3 * * * workflow_dispatch: env: RELEASE_NAME: nightly NPROC: 2 MAKEFLAGS: "-j${NPROC}" NIMFLAGS: "--parallelBuild:${NPROC}" jobs: build-and-publish: strategy: matrix: os: [ubuntu-latest, macos-latest] experimental: [true, false] arch: [amd64] include: - os: macos-latest experimental: false arch: arm64 runs-on: ${{ matrix.os }} steps: - name: Checkout code uses: actions/checkout@v3 - 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}-${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}}" \ update make QUICK_AND_DIRTY_COMPILER=1 V=1 CI=false EXPERIMENTAL=${{matrix.experimental}} NIMFLAGS="-d:disableMarchNative --os:${OS} --cpu:${{matrix.arch}}" \ wakunode2\ chat2\ tools tar -cvzf ${{steps.vars.outputs.nwaku}} ./build/wakunode2 ./build/chat2 tar -cvzf ${{steps.vars.outputs.nwakutools}} ./build/wakucanary ./build/networkmonitor - name: upload artifacts uses: actions/upload-artifact@v3 with: name: wakunode2 path: ${{steps.vars.outputs.nwaku}} retention-days: 2 - name: upload artifacts uses: actions/upload-artifact@v3 with: name: tools path: ${{steps.vars.outputs.nwakutools}} retention-days: 2 create-release-candidate: runs-on: ubuntu-latest needs: [ build-and-publish ] steps: - name: Checkout code uses: actions/checkout@v3 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: | 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 \ --rm \ -v ${PWD}:/opt/sv4git/repo:z \ -u $(id -u) \ docker.io/wakuorg/sv4git:latest \ 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 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/*