Skip to content

Commit 7550045

Browse files
committed
fix: add exe metadata
1 parent a25d69c commit 7550045

File tree

4 files changed

+85
-22
lines changed

4 files changed

+85
-22
lines changed

.github/workflows/component_packages.yml

Lines changed: 71 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ jobs:
3838
runs-on: ubuntu-latest
3939
name: Build and upload
4040
steps:
41-
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
41+
- uses: actions/checkout@v4
4242
with:
4343
fetch-depth: 0
4444

45-
- uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6
45+
- uses: actions/setup-go@v5
4646
with:
4747
go-version-file: 'build/embedded/go.mod'
4848
check-latest: true
@@ -65,19 +65,75 @@ jobs:
6565
save-cache: false
6666

6767
- name: Install Zig
68-
uses: mlugg/setup-zig@d1434d08867e3ee9daa34448df10607b98908d29 # v2
68+
uses: mlugg/setup-zig@v2
6969

70-
- uses: taiki-e/install-action@288875dd3d64326724fa6d9593062d9f8ba0b131 # v2.67.30
70+
- uses: taiki-e/install-action@v2
7171
with:
7272
tool: cargo-zigbuild@0.20.1
7373

7474
- name: Install Windows cross-compilation dependencies
7575
run: |
76-
sudo apt-get install -y llvm
76+
sudo apt-get update && sudo apt-get install -y llvm nasm
77+
sudo ln -sf /usr/bin/llvm-ar /usr/bin/llvm-lib
7778
78-
- name: Install cargo-xwin
79+
- name: Install and Pre-cache cargo-xwin
7980
run: |
80-
cargo install --locked cargo-xwin --force
81+
cargo install --locked cargo-xwin
82+
83+
rm -rf /home/runner/.cache/cargo-xwin
84+
85+
cd /tmp
86+
cargo new pre_cache_dummy
87+
cd pre_cache_dummy
88+
89+
cargo xwin build --target x86_64-pc-windows-msvc
90+
91+
cd $GITHUB_WORKSPACE
92+
93+
- name: Install go-winres
94+
run: go install github.com/tc-hib/go-winres@latest
95+
96+
- name: Generate Windows Metadata JSONs
97+
run: |
98+
cat <<EOF > /tmp/winres-agent.json
99+
{
100+
"RT_VERSION": {
101+
"#1": {
102+
"0000": {
103+
"info": {
104+
"0409": {
105+
"CompanyName": "New Relic, Inc.",
106+
"FileDescription": "New Relic Agent Control",
107+
"LegalCopyright": "© 2026 New Relic, Inc. All rights reserved.",
108+
"OriginalFilename": "newrelic-agent-control.exe",
109+
"ProductName": "New Relic Agent Control"
110+
}
111+
}
112+
}
113+
}
114+
}
115+
}
116+
EOF
117+
118+
cat <<EOF > /tmp/winres-cli.json
119+
{
120+
"RT_VERSION": {
121+
"#1": {
122+
"0000": {
123+
"info": {
124+
"0409": {
125+
"CompanyName": "New Relic, Inc.",
126+
"FileDescription": "New Relic Agent Control CLI",
127+
"LegalCopyright": "© 2026 New Relic, Inc. All rights reserved.",
128+
"OriginalFilename": "newrelic-agent-control-cli.exe",
129+
"ProductName": "New Relic Agent Control CLI"
130+
}
131+
}
132+
}
133+
}
134+
}
135+
}
136+
EOF
81137
82138
- name: If pre-release, set tag and verify it matches Cargo.toml version
83139
if: ${{ inputs.pre-release}}
@@ -101,22 +157,22 @@ jobs:
101157
echo SKIP_WINDOWS_SIGN="true" >> $GITHUB_ENV
102158
103159
- name: Release packages with GoReleaser
104-
uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a # v6
160+
uses: goreleaser/goreleaser-action@v6
105161
with:
106-
args: release ${{ env.SKIP_UPLOAD_RELEASE }} ${{ env.SKIP_SIGN }} --clean --verbose --timeout 2h
162+
args: release ${{ env.SKIP_UPLOAD_RELEASE }} ${{ env.SKIP_SIGN }} --clean --verbose --timeout 2h --parallelism 1
107163
env:
108164
GITHUB_TOKEN: ${{ secrets.gh_token }}
109-
GPG_PRIVATE_KEY_BASE64: ${{ secrets.gpg_private_key_base64 }} # base64 encoded
165+
GPG_PRIVATE_KEY_BASE64: ${{ secrets.gpg_private_key_base64 }}
110166
GPG_PASSPHRASE: ${{ secrets.gpg_passphrase }}
111-
PFX_CERTIFICATE_BASE64: ${{ secrets.pfx_certificate_base64 }} # base64 encoded
167+
PFX_CERTIFICATE_BASE64: ${{ secrets.pfx_certificate_base64 }}
112168
PFX_PASSPHRASE: ${{ secrets.pfx_passphrase }}
113169
GPG_MAIL: 'infrastructure-eng@newrelic.com'
114170
NR_RELEASE_TAG: ${{ inputs.tag_name }}
115171
GORELEASER_CURRENT_TAG: ${{ inputs.tag_name }}
116172
SKIP_WINDOWS_SIGN: ${{ env.SKIP_WINDOWS_SIGN }}
117173

118174
- name: Upload assets to pipeline
119-
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
175+
uses: actions/upload-artifact@v4
120176
with:
121177
retention-days: 1
122178
name: built-binaries-${{ inputs.tag_name }}
@@ -130,10 +186,10 @@ jobs:
130186
needs: build
131187
if: ${{ ! inputs.skip_sign }}
132188
steps:
133-
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
189+
- uses: actions/checkout@v4
134190

135191
- name: Download built binaries
136-
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7
192+
uses: actions/download-artifact@v4
137193
with:
138194
name: built-binaries-${{ inputs.tag_name }}
139195
path: ./artifacts
@@ -144,4 +200,4 @@ jobs:
144200
./build/scripts/windows-exec-sign/verify-signature.ps1 -Executables @(
145201
"./artifacts/dist/newrelic-agent-control-windows_x86_64-pc-windows-msvc/newrelic-agent-control.exe",
146202
"./artifacts/dist/newrelic-agent-control-cli-windows_x86_64-pc-windows-msvc/newrelic-agent-control-cli.exe"
147-
)
203+
)

.goreleaser.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ builds:
4949
- NR_OTEL_COLLECTOR_VERSION={{ .Env.NR_OTEL_COLLECTOR_VERSION }}
5050
hooks:
5151
post:
52+
- cmd: /home/runner/go/bin/go-winres patch --in /tmp/winres-agent.json --product-version {{ .Version }} --file-version {{ .Version }} {{ .Path }}
5253
- cmd: ./build/scripts/windows-exec-sign/sign.sh
5354
env:
5455
- SKIP_WINDOWS_SIGN={{ if index .Env "SKIP_WINDOWS_SIGN"}}{{ .Env.SKIP_WINDOWS_SIGN }}{{ else }}{{ end }}
@@ -86,11 +87,12 @@ builds:
8687
env:
8788
- AGENT_CONTROL_VERSION={{ .Version }}
8889
hooks:
89-
pre:
90-
# Wait for newrelic-agent-control to be ready (parallel executions of cargo-xwin can be problematic)
91-
- cmd: sh -c 'while [ ! -f target/x86_64-pc-windows-msvc/release/newrelic-agent-control.exe ]; do echo "Waiting for newrelic-agent-control-windows build to complete..."; sleep 5; done'
92-
output: true
90+
# pre:
91+
# # Wait for newrelic-agent-control to be ready (parallel executions of cargo-xwin can be problematic)
92+
# - cmd: sh -c 'while [ ! -f target/x86_64-pc-windows-msvc/release/newrelic-agent-control.exe ]; do echo "Waiting for newrelic-agent-control-windows build to complete..."; sleep 5; done'
93+
# output: true
9394
post:
95+
- cmd: /home/runner/go/bin/go-winres patch --in /tmp/winres-cli.json --product-version {{ .Version }} --file-version {{ .Version }} {{ .Path }}
9496
# This step cannot be done inside the 'signs' section because that happens after packaging.
9597
- cmd: ./build/scripts/windows-exec-sign/sign.sh
9698
env:

THIRD_PARTY_NOTICES.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3045,6 +3045,12 @@ Distributed under the following license(s):
30453045

30463046
* MIT
30473047

3048+
## winres <https://crates.io/crates/winres>
3049+
3050+
Distributed under the following license(s):
3051+
3052+
* MIT
3053+
30483054
## wit-bindgen <https://crates.io/crates/wit-bindgen>
30493055

30503056
Distributed under the following license(s):

agent-control/build.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,9 @@ const GENERATED_REGISTRY_FILE: &str = "generated_agent_type_registry.rs";
1212

1313
fn main() {
1414
generate_agent_type_registry();
15-
// setup the env variable for the generated registry path
15+
1616
println!("cargo:rustc-env=GENERATED_REGISTRY_FILE={GENERATED_REGISTRY_FILE}");
17-
// re-run only if the registry has changed
18-
println!("cargo:rerun-if-changed={REGISTRY_PATH}")
17+
println!("cargo:rerun-if-changed={REGISTRY_PATH}");
1918
}
2019

2120
fn generate_agent_type_registry() {

0 commit comments

Comments
 (0)