Update ci.yml #8
Workflow file for this run
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
name: ci | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- "**" | |
paths: | |
- ".github/workflows/ci.yml" | |
- "src/**" | |
- "*.sln" | |
- "*.props" | |
tags: | |
- "v*" | |
pull_request: | |
branches: | |
- "**" | |
paths: | |
- ".github/workflows/ci.yml" | |
- "src/**" | |
- "*.sln" | |
- "*.props" | |
jobs: | |
meta: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- id: meta | |
shell: bash | |
run: | | |
is_release=${{ startsWith(github.ref, 'refs/tags/v') }} | |
tag=$(git describe --tags --match "v*" ${{ github.ref }} || true) | |
if ! $($is_release) ; then | |
prefix=${tag%-*-*} | |
suffix=${tag#$prefix-} | |
tag="$prefix-Preview.$suffix" | |
fi | |
echo tag=$tag | tee -a $GITHUB_OUTPUT | |
echo version=${tag#v} | tee -a $GITHUB_OUTPUT | |
echo is_release=$is_release | tee -a $GITHUB_OUTPUT | |
outputs: | |
tag: ${{ steps.meta.outputs.tag }} | |
version: ${{ steps.meta.outputs.version }} | |
is_release: ${{ steps.meta.outputs.is_release }} | |
publish: | |
needs: [meta] | |
strategy: | |
matrix: | |
os: [windows-latest, ubuntu-latest, macos-latest] | |
arch: [aarch64, x86_64] | |
dotnet: [ '7.0' ] | |
fail-fast: false | |
env: | |
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
fetch-depth: 0 | |
- uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: ${{ matrix.dotnet }} | |
cache: true | |
cache-dependency-path: '**/packages.lock.json' | |
- run: dotnet restore --locked-mode | |
- name: Build | |
id: build | |
shell: bash | |
run: | | |
dotnet publish\ | |
--configuration Release \ | |
--no-restore \ | |
-p:Version=${{ needs.meta.outputs.version }} \ | |
-p:OnPublishing=true | |
RID=$(ls ./src/MBA.Cli/bin/Release/net${{ matrix.dotnet }}/) | |
echo RID=$RID | tee -a $GITHUB_OUTPUT | |
- uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: MBA-${{ steps.build.outputs.RID }} | |
path: "src/MBA.Cli/bin/Release/net${{ matrix.dotnet }}/${{ steps.build.outputs.RID }}/publish" | |
release: | |
#if: ${{ needs.meta.outputs.is_release == 'true' }} | |
needs: [meta, publish] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
path: assets | |
- run: | | |
cd assets | |
ls -al | |
for f in *; do | |
ls -al | |
(cd $f && zip -r ../$f-${{ needs.meta.outputs.tag }}.zip .) | |
done | |
- uses: softprops/action-gh-release@v1 | |
if: false | |
with: | |
files: assets/*.zip | |
tag_name: ${{ needs.meta.outputs.tag }} |