Publish nightly builds to netdata/netdata-nightlies repository. (#13961)
* Publish nightly builds to netdata/netdata-nightlies repository. The target repo is currently private, but will be made public when we have established that publishing to it is working correctly. * Fix typo. * Fix shellcheck warnings.
Austin S. Hemmelgarn committed
Nov 15, 2022 at 07:34 UTC
b4a0298bd48f217c4a6f2eaf729e0684966ea7a3
1 file changed
+69
.github/workflows/build.yml
+69
@@ -706,6 +706,75 @@ jobs:
706
&& github.event_name != 'pull_request'
707
}}
708
709
+ create-nightly: # Create a nightly build release in netdata/netdata-nightlies
710
+ name: Create Nightly Release
711
+ runs-on: ubuntu-latest
712
+ if: github.event_name == 'workflow_dispatch' && github.event.inputs.type == 'nightly' && github.repository == 'netdata/netdata'
713
+ needs:
714
+ - updater-check
715
+ - source-build
716
+ - artifact-verification-dist
717
+ - artifact-verification-static
718
+ steps:
719
+ - name: Checkout Main Repo
720
+ id: checkout-main
721
+ uses: actions/checkout@v3
722
+ with:
723
+ path: main
724
+ - name: Checkout Nightly Repo
725
+ id: checkout-nightly
726
+ uses: actions/checkout@v3
727
+ with:
728
+ repository: netdata/netdata-nightlies
729
+ path: nightlies
730
+ - name: Retrieve Artifacts
731
+ id: fetch
732
+ uses: actions/download-artifact@v3
733
+ with:
734
+ name: final-artifacts
735
+ path: final-artifacts
736
+ - name: Prepare version info
737
+ id: version
738
+ run: |
739
+ # shellcheck disable=SC2129
740
+ echo "version=$(cat main/packaging/version)" >> "${GITHUB_OUTPUT}"
741
+ echo "commit=$(cd nightlies && git rev-parse HEAD)" >> "${GITHUB_OUTPUT}"
742
+ echo "date=$(date +%F)" >> "${GITHUB_OUTPUT}"
743
+ - name: Create Release
744
+ id: create-release
745
+ uses: ncipollo/release-action@v1
746
+ with:
747
+ allowUpdates: false
748
+ artifactErrorsFailBuild: true
749
+ artifacts: 'final-artifacts/sha256sums.txt,final-artifacts/netdata-*.tar.gz,final-artifacts/netdata-*.gz.run'
750
+ owner: netdata
751
+ repo: netdata-nightlies
752
+ body: Netdata nightly build for ${{ steps.version.outputs.date }}.
753
+ commit: ${{ steps.version.outputs.commit }}
754
+ tag: ${{ steps.version.outputs.version }}
755
+ token: ${{ secrets.NETDATABOT_GITHUB_TOKEN }}
756
+ - name: Failure Notification
757
+ uses: rtCamp/action-slack-notify@v2
758
+ env:
759
+ SLACK_COLOR: 'danger'
760
+ SLACK_FOOTER: ''
761
+ SLACK_ICON_EMOJI: ':github-actions:'
762
+ SLACK_TITLE: 'Failed to draft release:'
763
+ SLACK_USERNAME: 'GitHub Actions'
764
+ SLACK_MESSAGE: |-
765
+ ${{ github.repository }}: Failed to create nightly release or attach artifacts.
766
+ Checkout netdata/netdata: ${{ steps.checkout-main.outcome }}
767
+ Checkout netdata/netdata-nightlies: ${{ steps.checkout-nightly.outcome }}
768
+ Fetch artifacts: ${{ steps.fetch.outcome }}
769
+ Prepare version info: ${{ steps.version.outcome }}
770
+ Create release: ${{ steps.create-release.outcome }}
771
+ SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
772
+ if: >-
773
+ ${{
774
+ failure()
775
+ && github.event_name == 'workflow_dispatch'
776
+ }}
777
+
778
normalize-tag: # Fix the release tag if needed
779
name: Normalize Release Tag
780
runs-on: ubuntu-latest