From c35d19980914c6532760a737d1af05d06b852c8f Mon Sep 17 00:00:00 2001 From: Nebula Date: Sun, 14 May 2023 21:04:38 -0400 Subject: [PATCH] ci: Discord build message improvements --- .github/workflows/build.yml | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 93066ea..3111a0c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -24,7 +24,7 @@ on: jobs: build-docs: runs-on: ubuntu-latest - steps: + steps: - name: Checkout uses: actions/checkout@v3 @@ -461,6 +461,15 @@ jobs: dpkg-deb -Zzstd -b stage palera1n_iphoneos-arm64.deb mv palera1n*.deb ready/ rm -rf stage + + - name: Save build tag + run: echo "$(git describe --dirty --tags --abbrev=7 | sed 's|-dirty||')" > build-tag.txt + + - name: Upload build tag + uses: actions/upload-artifact@v3 + with: + name: build-tag + path: build-tag.txt - name: Upload artifact if: ${{ github.event_name != 'pull_request' }} @@ -789,9 +798,21 @@ jobs: if: ${{ github.event_name != 'pull_request' }} needs: [build-docs, build-darwin, darwin-dist, build-Linux] steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Get branch name + uses: nelonoel/branch-name@v1.0.1 + + - name: Download build tag + uses: actions/download-artifact@v3 + with: + name: build-tag + - name: Send Discord build message if: github.ref == 'refs/heads/master' run: | - COMMITMESSAGE=`git log --pretty=format:'- \`%h\` %s' -5 --reverse` && - (curl "${{ secrets.DISCORD_WEBHOOK }}" -sS -H "Content-Type:application/json" -X POST -d "{\"content\":null,\"embeds\":[{\"title\":\"Build $BUILD\",\"description\":\"**Branch:** $BRANCH_NAME\\n**Changes:**\\n$COMMITMESSAGE\",\"url\":\"https://github.com/palera1n/palera1n/actions/runs/$GITHUB_RUN_ID\",\"color\":1487872,\"fields\":[{\"name\":\"Artifacts:\",\"value\":\"- [palera1n-ios](https://cdn.nickchan.lol/palera1n/artifacts/c-rewrite/palera1n-ios)\n- [palera1n-linux-arm64](https://cdn.nickchan.lol/palera1n/artifacts/c-rewrite/palera1n-linux-arm64)\n- [palera1n-linux-armel](https://cdn.nickchan.lol/palera1n/artifacts/c-rewrite/palera1n-linux-armel)\n- [palera1n-linux-x86](https://cdn.nickchan.lol/palera1n/artifacts/c-rewrite/palera1n-linux-x86)\n- [palera1n-linux-x86_64](https://cdn.nickchan.lol/palera1n/artifacts/c-rewrite/palera1n-linux-x86_64)\n- [palera1n-macos-universal](https://cdn.nickchan.lol/palera1n/artifacts/c-rewrite/palera1n-macos-universal)\n- [palera1n.1](https://cdn.nickchan.lol/palera1n/artifacts/c-rewrite/palera1n.1.html)\"}],\"footer\":{\"text\":\"https://github.com/palera1n/palera1n\"},\"thumbnail\":{\"url\":\"https://github.com/palera1n.png\"}}],\"username\":\"Github Actions\",\"avatar_url\":\"https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png\"}") + echo "${{ github.event.repository.updated_at}}" + COMMITMESSAGE=`git log --pretty=format:'- \`%h\` %s' -1 --reverse` && + (curl "${{ secrets.DISCORD_WEBHOOK }}" -sS -H "Content-Type:application/json" -X POST -d "{\"content\":null,\"embeds\":[{\"title\":\"Nightly Build ${BUILD}\",\"url\":\"https://github.com/palera1n/palera1n/actions/runs/${GITHUB_RUN_ID}\",\"color\":1487872,\"fields\":[{\"name\":\"Build tag:\",\"value\":\"- \`$(cat build-tag.txt | sed 's|\n||')\`\"},{\"name\":\"Branch:\",\"value\":\"- \`${BRANCH_NAME}\`\"},{\"name\":\"Changes:\",\"value\":\"$(echo $COMMITMESSAGE | awk '{printf "%s\\n", $0}')\"},{\"name\":\"Artifacts:\",\"value\":\"- [palera1n-ios](https://cdn.nickchan.lol/palera1n/artifacts/c-rewrite/palera1n-ios)\n- [palera1n-linux-arm64](https://cdn.nickchan.lol/palera1n/artifacts/c-rewrite/palera1n-linux-arm64)\n- [palera1n-linux-armel](https://cdn.nickchan.lol/palera1n/artifacts/c-rewrite/palera1n-linux-armel)\n- [palera1n-linux-x86](https://cdn.nickchan.lol/palera1n/artifacts/c-rewrite/palera1n-linux-x86)\n- [palera1n-linux-x86_64](https://cdn.nickchan.lol/palera1n/artifacts/c-rewrite/palera1n-linux-x86_64)\n- [palera1n-macos-universal](https://cdn.nickchan.lol/palera1n/artifacts/c-rewrite/palera1n-macos-universal)\n- [palera1n.1](https://cdn.nickchan.lol/palera1n/artifacts/c-rewrite/palera1n.1.html)\"}],\"footer\":{\"text\":\"palera1n/palera1n\", \"icon_url\": \"https://media.discordapp.net/attachments/1054239098006683688/1107471339176071288/palera1n_ios_copy.png?width=1208&height=1208\"},\"thumbnail\":{\"url\":\"https://github.com/palera1n.png\"}}],\"username\":\"GitHub Actions\",\"avatar_url\":\"https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png\"}") \ No newline at end of file