|
| 1 | +name: Nightly Release |
| 2 | + |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + - cron: 13 3 * * * |
| 6 | + workflow_dispatch: |
| 7 | + |
| 8 | +env: |
| 9 | + RELEASE_NAME: nightly |
| 10 | + |
| 11 | + NPROC: 2 |
| 12 | + MAKEFLAGS: "-j${NPROC}" |
| 13 | + NIMFLAGS: "--parallelBuild:${NPROC}" |
| 14 | + |
| 15 | +jobs: |
| 16 | + build-and-publish: |
| 17 | + strategy: |
| 18 | + matrix: |
| 19 | + os: [ubuntu-latest, macos-latest] |
| 20 | + runs-on: ${{ matrix.os }} |
| 21 | + steps: |
| 22 | + - name: Checkout code |
| 23 | + uses: actions/checkout@v3 |
| 24 | + |
| 25 | + - name: Get submodules hash |
| 26 | + id: submodules |
| 27 | + run: | |
| 28 | + echo "hash=$(git submodule status | awk '{print $1}' | sort | shasum -a 256 | sed 's/[ -]*//g')" >> $GITHUB_OUTPUT |
| 29 | +
|
| 30 | + - name: Cache submodules |
| 31 | + uses: actions/cache@v3 |
| 32 | + with: |
| 33 | + path: | |
| 34 | + vendor/ |
| 35 | + .git/modules |
| 36 | + key: ${{ runner.os }}-vendor-modules-${{ steps.submodules.outputs.hash }} |
| 37 | + |
| 38 | + |
| 39 | + - name: build artifacts |
| 40 | + id: build |
| 41 | + run: | |
| 42 | + ARCH=$(uname -m) |
| 43 | + echo "arch=${ARCH}" >> $GITHUB_OUTPUT |
| 44 | + make QUICK_AND_DIRTY_COMPILER=1 V=1 CI=false wakunode2 tools |
| 45 | +
|
| 46 | + tar -cvzf nwaku-${ARCH}-${{runner.os}}.tar.gz ./build/wakunode2 |
| 47 | + tar -cvzf nwaku-tools-${ARCH}-${{runner.os}}.tar.gz ./build/wakucanary ./build/networkmonitor |
| 48 | +
|
| 49 | + - name: upload artifacts |
| 50 | + uses: actions/upload-artifact@v3 |
| 51 | + with: |
| 52 | + name: wakunode2 |
| 53 | + path: nwaku-${{steps.build.outputs.arch}}-${{runner.os}}.tar.gz |
| 54 | + retention-days: 2 |
| 55 | + |
| 56 | + - name: upload artifacts |
| 57 | + uses: actions/upload-artifact@v3 |
| 58 | + with: |
| 59 | + name: tools |
| 60 | + path: nwaku-tools-${{steps.build.outputs.arch}}-${{runner.os}}.tar.gz |
| 61 | + retention-days: 2 |
| 62 | + |
| 63 | + create-release-candidate: |
| 64 | + runs-on: ubuntu-latest |
| 65 | + needs: [ build-and-publish ] |
| 66 | + steps: |
| 67 | + - name: Checkout code |
| 68 | + uses: actions/checkout@v3 |
| 69 | + with: |
| 70 | + fetch-depth: 0 |
| 71 | + ref: master |
| 72 | + - name: download artifacts |
| 73 | + uses: actions/download-artifact@v2 |
| 74 | + - name: generate release notes |
| 75 | + env: |
| 76 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 77 | + run: | |
| 78 | + gh release view ${RELEASE_NAME} &>/dev/null &&\ |
| 79 | + gh release delete -y ${RELEASE_NAME} --cleanup-tag &&\ |
| 80 | + git tag -d ${RELEASE_NAME} |
| 81 | +
|
| 82 | + docker run \ |
| 83 | + -t \ |
| 84 | + --rm \ |
| 85 | + -v ${PWD}:/opt/sv4git/repo:z \ |
| 86 | + -u $(id -u) \ |
| 87 | + docker.io/wakuorg/sv4git:latest \ |
| 88 | + release-notes |\ |
| 89 | + sed -E 's@#([0-9]+)@[#\1](https://github.com/waku-org/nwaku/issues/\1)@g' > release_notes.md |
| 90 | +
|
| 91 | + sed -i "s/^## .*/Generated at $(date)/" release_notes.md |
| 92 | +
|
| 93 | + cat release_notes.md |
| 94 | +
|
| 95 | + gh release create ${RELEASE_NAME} --prerelease --target master \ |
| 96 | + --title ${RELEASE_NAME} --notes-file release_notes.md \ |
| 97 | + wakunode2/* tools/* |
0 commit comments