-
Notifications
You must be signed in to change notification settings - Fork 173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(ci): release builds #2219
fix(ci): release builds #2219
Changes from all commits
7bf38a5
ee8aef6
b750a72
4824863
f8805e0
afc7902
66352d4
c7a6c61
8f2192d
2748134
5c6e777
501c983
7511616
74740b0
e6943dc
8139bb0
63fa65f
b764499
a9fa815
73c59b9
13f5821
ced3e3a
269d26e
785d86d
8b06289
627c5bc
b451cf2
a072084
bb36995
b28f041
8e5eb0a
6c8b7b1
37a6e9e
f272978
173e21d
e74001f
105449f
6647bb1
c0ef07d
4c99f85
54c34ef
77e5a4e
d782e4f
4fa1779
c267ba0
4087541
f2ef68f
bfaf0d0
1cb89e8
da530a4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Set line endings to LF, even on Windows. Otherwise, execution within CI fails. | ||
# See https://help.github.com/articles/dealing-with-line-endings/ | ||
*.sh text eol=lf |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,7 @@ env: | |
MSRV: "1.75" | ||
SCCACHE_CACHE_SIZE: "50G" | ||
BIN_NAMES: "iroh,iroh-relay,iroh-dns-server" | ||
RELEASE_VERSION: ${{ github.event.inputs.release_version }} | ||
|
||
jobs: | ||
create-release: | ||
|
@@ -39,13 +40,18 @@ jobs: | |
upload_url: ${{ steps.release.outputs.upload_url }} | ||
release_version: ${{ env.RELEASE_VERSION }} | ||
steps: | ||
- name: Get the release version from the tag (push) | ||
- name: Get the release version from the tag or input | ||
shell: bash | ||
if: env.RELEASE_VERSION == '' && github.event_name == 'push' | ||
if: env.RELEASE_VERSION == '' | ||
run: | | ||
# See: https://github.community/t5/GitHub-Actions/How-to-get-just-the-tag-name/m-p/32167/highlight/true#M1027 | ||
echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | ||
echo "version is: ${{ env.RELEASE_VERSION }}" | ||
if "${{ github.event.inputs.release_version }}" != ""; then | ||
echo "RELEASE_VERSION=${{ github.event.inputs.release_version }}" >> $GITHUB_ENV | ||
echo "version is: ${{ env.RELEASE_VERSION }}" | ||
else | ||
# See: https://github.community/t5/GitHub-Actions/How-to-get-just-the-tag-name/m-p/32167/highlight/true#M1027 | ||
echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | ||
echo "version is: ${{ env.RELEASE_VERSION }}" | ||
fi | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
|
@@ -57,6 +63,7 @@ jobs: | |
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
draft: true | ||
tag_name: ${{ env.RELEASE_VERSION || github.event.inputs.release_version}} | ||
release_name: ${{ env.RELEASE_VERSION || github.event.inputs.release_version }} | ||
|
||
|
@@ -138,13 +145,18 @@ jobs: | |
rustup target add ${{ matrix.cargo_targets }} | ||
|
||
- name: build release | ||
if: matrix.os != 'windows-latest' | ||
shell: bash | ||
run: | | ||
if [ "${{ matrix.name }}" = "ubuntu-arm-latest" ]; then | ||
export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=aarch64-linux-gnu-gcc | ||
export CC=aarch64-linux-gnu-gcc | ||
fi | ||
cargo build --profile optimized-release --all-features --target ${{ matrix.cargo_targets }} | ||
|
||
- name: build release | ||
if: matrix.os == 'windows-latest' | ||
run: cargo build --profile optimized-release --all-features --target ${{ matrix.cargo_targets }} | ||
Comment on lines
+156
to
+159
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't get why windows gets its own section here, the cargo command is exactly the same as the unix version above? |
||
|
||
- name: attach artifacts | ||
if: matrix.os != 'windows-latest' | ||
|
@@ -204,36 +216,40 @@ jobs: | |
aws s3 cp ./target/${{ matrix.cargo_targets }}/optimized-release/iroh-dns-server s3://vorc/iroh-dns-server-${RELEASE_OS}-${RELEASE_ARCH}-latest --no-progress | ||
|
||
- name: Build archives | ||
if: matrix.os != 'windows-latest' | ||
shell: bash | ||
run: | | ||
IFS=',' read -ra BIN_NAMES <<< "${{ env.BIN_NAMES }}" | ||
ASSETS="" | ||
for BIN_NAME in "${BIN_NAMES[@]}"; do | ||
staging="$BIN_NAME-${{ needs.create-release.outputs.release_version }}-${{ matrix.cargo_targets }}" | ||
mkdir -p "$staging" | ||
if [ "${{ matrix.os }}" = "windows-latest" ]; then | ||
cp "target/${{ matrix.cargo_targets }}/optimized-release/$BIN_NAME.exe" "$staging/" | ||
cd "$staging" | ||
7z a "../$staging.zip" . | ||
ASSETS+="$staging.zip," | ||
else | ||
cp "target/${{ matrix.cargo_targets }}/optimized-release/$BIN_NAME" "$staging/" | ||
tar czf "$staging.tar.gz" -C "$staging" . | ||
ASSETS+="$staging.tar.gz," | ||
fi | ||
cp "target/${{ matrix.cargo_targets }}/optimized-release/$BIN_NAME" "$staging/" | ||
tar czf "$staging.tar.gz" -C "$staging" . | ||
ASSETS+="$staging.tar.gz," | ||
done | ||
echo "ASSET=${ASSETS::-1}" >> $GITHUB_ENV | ||
echo "ASSET=$(echo $ASSETS | sed 's/,$//')" >> $GITHUB_ENV | ||
|
||
- name: Upload release archives | ||
if: github.event.inputs.upload_artifacts == 'true' || github.event_name == 'push' | ||
- name: Build archives (windows) | ||
if: matrix.os == 'windows-latest' | ||
shell: pwsh | ||
run: | | ||
IFS=',' read -ra ASSETS <<< "${{ env.ASSET }}" | ||
for ASSET in "${ASSETS[@]}"; do | ||
ASSET_NAME=$(basename $ASSET) | ||
curl \ | ||
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | ||
-H "Content-Type: $(file -b --mime-type application/octet-stream)" \ | ||
--data-binary @"$ASSET" \ | ||
"${{ needs.create-release.outputs.upload_url }}?name=$ASSET_NAME" | ||
done | ||
|
||
$BIN_NAMES = "${{ env.BIN_NAMES }}".Split(',') | ||
$ASSETS = @() | ||
foreach ($BIN_NAME in $BIN_NAMES) { | ||
$staging = "$BIN_NAME-${{ needs.create-release.outputs.release_version }}-${{ matrix.cargo_targets }}" | ||
New-Item -ItemType Directory -Force -Path "$staging" | ||
Copy-Item -Path "target/${{ matrix.cargo_targets }}/optimized-release/$BIN_NAME.exe" -Destination "$staging/" | ||
Set-Location -Path "$staging" | ||
Compress-Archive -Path * -DestinationPath "../$staging.zip" | ||
$ASSETS += "$staging.zip" | ||
Set-Location -Path .. | ||
} | ||
$ASSETS = $ASSETS -join ',' | ||
Add-Content -Path $env:GITHUB_ENV -Value "ASSET=$ASSETS" | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm in general a bit careful about using actions from a branch rather than a tag, which can still be moving like .e.g. |
||
- uses: n0-computer/actions-upload-release-asset@main | ||
if: (github.event.inputs.upload_artifacts == 'true' || github.event_name == 'push') | ||
with: | ||
upload_url: ${{ needs.create-release.outputs.upload_url }} | ||
asset_path: ${{ env.ASSET }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given you have a whole script a little lower to set this in several ways I assume this is a leftover of an earlier version and should be removed?