This repository has been archived by the owner on Sep 6, 2024. It is now read-only.
Build #114
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
# Build the MSI installer. | |
name: Build | |
on: | |
push: | |
branches: | |
- master | |
pull_request: null | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: Docker tag to use as base | |
default: latest | |
required: true | |
pwd: | |
description: Certificate password | |
default: pwd | |
required: true | |
concurrency: | |
group: build-${{ github.ref }}-${{ github.event_name }} | |
cancel-in-progress: true | |
jobs: | |
get-docker-tag: | |
name: Get Docker Tag | |
outputs: | |
tag: ${{ steps.prepare.outputs.tag }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Prepare Docker Tag | |
id: prepare | |
run: | | |
if [ "${{ github.event_name }}" = 'workflow_dispatch' ]; then | |
echo "tag=${{ github.event.inputs.tag }}" >> "${GITHUB_OUTPUT}" | |
else | |
echo "tag=latest" >> "${GITHUB_OUTPUT}" | |
fi | |
prepare-tarball: | |
name: Prepare Tarball | |
needs: | |
- get-docker-tag | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
id: checkout | |
uses: actions/checkout@v4 | |
- name: Generate Tarball | |
id: generate | |
run: sh src/docker_image_to_wsl_tar.sh "${{ needs.get-docker-tag.outputs.tag }}" | |
- name: Store Tarball | |
id: store | |
uses: actions/upload-artifact@v3 | |
with: | |
name: netdata-tarball | |
path: netdata.tar | |
build-msi: | |
name: Build MSI | |
needs: | |
- prepare-tarball | |
- get-netdata-version | |
runs-on: windows-latest | |
steps: | |
- name: Checkout | |
id: checkout | |
uses: actions/checkout@v4 | |
- name: Prepare Tools | |
id: prepare | |
run: choco install wixtoolset | |
- name: Fetch Tarball | |
id: fetch | |
uses: actions/download-artifact@v3 | |
with: | |
name: netdata-tarball | |
path: src/ | |
- name: Build MSI | |
id: build | |
working-directory: src | |
shell: pwsh | |
env: | |
P12BASE64: ${{ secrets.NETDATA_CLOUD_KEY_P12_BASE64 }} | |
run: | | |
& "C:\Program Files (x86)\WiX Toolset v3.11\bin\candle.exe" -dProductVersion="${{ needs.get-netdata-version.outputs.versionwix }}" -nologo .\netdata.wxs -v -out .\netdata.wixobj | |
& "C:\Program Files (x86)\WiX Toolset v3.11\bin\light.exe" .\netdata.wixobj -spdb -v -out .\netdata.msi | |
[System.IO.File]::WriteAllBytes('netdata.cloud.key.p12', [System.Convert]::FromBase64String($Env:P12BASE64)) | |
& .\signtool.exe sign /f netdata.cloud.key.p12 /p '${{ github.event.inputs.pwd }}' .\netdata.msi | |
dir .\ | |
- name: Upload MSI | |
id: upload | |
uses: actions/upload-artifact@v3 | |
with: | |
name: netdata-msi | |
path: src/netdata.msi | |
prepare-release-tag: | |
name: Prepare Release Tag | |
if: github.event_name == 'workflow_dispatch' | |
outputs: | |
tag: ${{ steps.tag.outputs.tag }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Create Release Tag | |
id: tag | |
run: echo "tag=$(date +%F_%T | tr -d ':-_')" >> "${GITHUB_OUTPUT}" | |
get-netdata-version: | |
name: Get Netdata Version | |
if: github.event_name == 'workflow_dispatch' | |
outputs: | |
version: ${{ steps.get-version.outputs.version }} | |
versionwix: ${{ steps.get-version-for-wix.outputs.versionwix }} | |
needs: | |
- get-docker-tag | |
runs-on: ubuntu-latest | |
steps: | |
- name: Fetch Image | |
id: fetch | |
run: docker pull "netdata/netdata:${{ needs.get-docker-tag.outputs.tag }}" | |
- name: Get Version | |
id: get-version | |
run: | | |
echo "version=$(podman run -it --rm --entrypoint /usr/sbin/netdata netdata/netdata -V 2>/dev/null | cut -f 2 -d ' ')" >> "${GITHUB_OUTPUT}" | |
- name: Get Version for WiX | |
id: get-version-for-wix | |
run: | | |
echo "versionwix=$(podman run -it --rm --entrypoint /usr/sbin/netdata netdata/netdata -V 2>/dev/null | cut -f 2 -d ' ' | cut -f 2 -d 'v' | cut -f 1 -d '-')" >> "${GITHUB_OUTPUT}" | |
release: | |
name: Create Release | |
if: github.event_name == 'workflow_dispatch' | |
needs: | |
- build-msi | |
- prepare-release-tag | |
- get-netdata-version | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
id: checkout | |
uses: actions/checkout@v4 | |
- name: Fetch MSI | |
id: fetch | |
uses: actions/download-artifact@v3 | |
with: | |
name: netdata-msi | |
- name: Create Release | |
id: release | |
uses: ncipollo/release-action@v1 | |
with: | |
allowUpdates: false | |
artifactErrorsFailBuild: true | |
artifacts: 'netdata.msi' | |
body: With Netdata ${{ needs.get-netdata-version.outputs.version }}. | |
commit: master | |
tag: ${{ needs.prepare-release-tag.outputs.tag }} | |
token: ${{ secrets.NETDATABOT_GITHUB_TOKEN }} |