Skip to content

Commit

Permalink
ci: support core and app building
Browse files Browse the repository at this point in the history
  • Loading branch information
futrime committed Jan 9, 2025
1 parent 19075d8 commit 1d320a9
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 26 deletions.
12 changes: 4 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,9 @@ jobs:
with:
dotnet-version: ${{ env.DOTNET_VERSION }}

- run: |
dotnet restore Lip
- run: >
dotnet build Lip
-c Release
--no-restore
--configuration Release
build-app:
strategy:
Expand Down Expand Up @@ -90,9 +86,9 @@ jobs:
- run: >
dotnet publish ${{ matrix.project }}
-c Release
-o bin
-r ${{ matrix.runtime }}
--configuration Release
--output bin
--runtime ${{ matrix.runtime }}
-p:OptimizationPreference=Size
-p:PublishAot=true
Expand Down
39 changes: 21 additions & 18 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,16 @@ on:
types:
- published

env:
DOTNET_VERSION: 9.0.x

jobs:
build:
build-app:
strategy:
fail-fast: false
matrix:
project:
- Lip.CLI
include:
- runtime: linux-arm64
runs-on: ubuntu-22.04
Expand All @@ -27,7 +32,7 @@ jobs:

- uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.0.x
dotnet-version: ${{ env.DOTNET_VERSION }}

- if: matrix.runtime == 'linux-arm64'
run: |
Expand All @@ -43,16 +48,16 @@ jobs:
sudo apt install -y clang llvm binutils-aarch64-linux-gnu gcc-aarch64-linux-gnu zlib1g-dev:arm64
- run: >
dotnet publish Lip/Lip.csproj
-c Release
-o bin
-r ${{ matrix.runtime }}
dotnet publish ${{ matrix.project }}
--configuration Release
--output bin
--runtime ${{ matrix.runtime }}
-p:OptimizationPreference=Size
-p:PublishAot=true
- uses: actions/upload-artifact@v4
with:
name: ${{ github.event.repository.name }}-${{ matrix.runtime }}-${{ github.sha }}
name: ${{ github.event.repository.name }}-${{ matrix.project }}-${{ matrix.runtime }}-${{ github.sha }}
path: bin/

update-release-notes:
Expand All @@ -71,14 +76,16 @@ jobs:

upload-to-release:
needs:
- build
- build-app
- update-release-notes
permissions:
contents: write
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
project:
- Lip.CLI
runtime:
- linux-arm64
- linux-x64
Expand All @@ -91,33 +98,29 @@ jobs:

- uses: actions/download-artifact@v4
with:
name: ${{ github.event.repository.name }}-${{ matrix.runtime }}-${{ github.sha }}
name: ${{ github.event.repository.name }}-${{ matrix.project }}-${{ matrix.runtime }}-${{ github.sha }}
path: artifact/

- run: |
cp CHANGELOG.md LICENSE README.md artifact/
cp CHANGELOG.md COPYING README.md artifact/
- name: Pack artifact (Windows)
if: startsWith(matrix.runtime, 'win') == true
- if: startsWith(matrix.runtime, 'win') == true
run: |
zip -r ../${{ github.event.repository.name }}-${{ matrix.runtime }}.zip *
working-directory: artifact

- name: Pack artifact (Others)
if: startsWith(matrix.runtime, 'win') == false
- if: startsWith(matrix.runtime, 'win') == false
run: |
tar -czvf ../${{ github.event.repository.name }}-${{ matrix.runtime }}.tar.gz *
working-directory: artifact

- name: Upload artifact to release (Windows)
if: startsWith(matrix.runtime, 'win') == true
- if: startsWith(matrix.runtime, 'win') == true
uses: softprops/action-gh-release@v2
with:
files: |
${{ github.event.repository.name }}-${{ matrix.runtime }}.zip
- name: Upload artifact to release (Others)
if: startsWith(matrix.runtime, 'win') == false
- if: startsWith(matrix.runtime, 'win') == false
uses: softprops/action-gh-release@v2
with:
files: |
Expand Down

0 comments on commit 1d320a9

Please sign in to comment.