-
-
Notifications
You must be signed in to change notification settings - Fork 1
68 lines (57 loc) · 2.51 KB
/
dotnet_selfcontained.yml
File metadata and controls
68 lines (57 loc) · 2.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
name: Build and Upload .NET binary
on:
release:
types: [published]
jobs:
build-and-pack:
runs-on: ubuntu-latest
strategy:
matrix:
os: [linux-x64, linux-arm64, win-x64, osx-x64, osx-arm64]
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Extract version (without v)
id: version
run: |
if [ "${{ github.event_name }}" = "release" ]; then
# Extract version from release tag (remove any 'v' prefix)
VERSION="${{ github.event.release.tag_name }}"
VERSION=${VERSION#v} # Remove 'v' prefix if present
else
VERSION="${{ github.event.inputs.version }}"
VERSION=${VERSION#v} # Remove 'v' prefix if present
fi
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Syncing version: $VERSION"
- name: Build & Publish
run: |
dotnet publish ./src/BuslyCLI.Console/BuslyCLI.Console.csproj \
--configuration Release \
--runtime ${{ matrix.os }} \
--self-contained true \
--output ./artifacts/binaries/${{ matrix.os }} \
/p:PublishSingleFile=true
- name: Create Archive
run: |
TARGET_DIR="./artifacts/binaries/${{ matrix.os }}"
ARCHIVE_DIR="./artifacts/github-release-archives"
OUTPUT_BASE="${ARCHIVE_DIR}/busly-cli-${{ github.event.release.tag_name }}-${{ matrix.os }}"
# Ensure the output directory exists
mkdir -p "$ARCHIVE_DIR"
# Change to the target directory so archive contains only files
cd "$TARGET_DIR"
if [[ "${{ matrix.os }}" == "win-x64" ]]; then
zip -r "$OUTPUT_BASE.zip" .
else
tar -czf "$OUTPUT_BASE.tar.gz" .
fi
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./artifacts/github-release-archives/busly-cli-${{ github.event.release.tag_name }}-${{ matrix.os }}.${{ matrix.os == 'win-x64' && 'zip' || 'tar.gz' }}
asset_name: busyly-cli${{ github.event.release.tag_name }}-${{ matrix.os }}.${{ matrix.os == 'win-x64' && 'zip' || 'tar.gz' }}
asset_content_type: ${{ matrix.os == 'win-x64' && 'application/zip' || 'application/gzip' }}