mirror of
https://github.com/OpenLogics/MewtocolNet.git
synced 2025-12-06 03:01:24 +00:00
80 lines
2.5 KiB
YAML
80 lines
2.5 KiB
YAML
name: Publish pipeline
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
release:
|
|
types: [published]
|
|
|
|
permissions: write-all
|
|
jobs:
|
|
|
|
test-pipeline:
|
|
name: 'Invoke the test pipeline'
|
|
uses: ./.github/workflows/test-pipeline.yml
|
|
secrets: inherit
|
|
|
|
#Deploy package
|
|
publish-package:
|
|
name: 'Build and publish package'
|
|
needs: test-pipeline
|
|
runs-on: [self-hosted, linux, x64, womed-local-linux]
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Parse version tag
|
|
run: |
|
|
VERSION=${{ github.ref_name }}
|
|
echo "VERSION=${VERSION:1}" >> $GITHUB_ENV
|
|
|
|
- name: Set .csproj version to ${{ env.VERSION }}
|
|
run: |
|
|
sed -i 's/<Version>[0-9].[0-9].[0-9]<\/Version>/<Version>${{ env.VERSION }}<\/Version>/g' MewtocolNet/MewtocolNet.csproj
|
|
less MewtocolNet/MewtocolNet.csproj
|
|
|
|
- name: Setup .NET
|
|
uses: actions/setup-dotnet@v2
|
|
with:
|
|
dotnet-version: '6.0.x'
|
|
|
|
- name: Restore dependencies
|
|
run: dotnet restore
|
|
|
|
- name: Build as ${{ env.VERSION }}
|
|
run: dotnet build "MewtocolNet" --no-incremental
|
|
|
|
- name: Pack as ${{ env.VERSION }}
|
|
run: dotnet pack "MewtocolNet"
|
|
|
|
- name: Publish as ${{ env.VERSION }}
|
|
run: |
|
|
cd '${{ github.workspace }}/Builds'
|
|
ls -l
|
|
dotnet nuget push "*.nupkg" --skip-duplicate --api-key ${{ secrets.GITHUB_TOKEN }} --source "https://nuget.pkg.github.com/WOmed/index.json"
|
|
|
|
- name: 'Upload package to latest release'
|
|
uses: actions/upload-release-asset@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ github.token }}
|
|
with:
|
|
upload_url: "${{ github.event.release.upload_url }}"
|
|
asset_path: ${{ github.workspace }}/Builds/Mewtocol.NET.${{ env.VERSION }}.nupkg
|
|
asset_name: Mewtocol.NET.${{ env.VERSION }}.nupkg
|
|
asset_content_type: application/zip
|
|
|
|
- name: Load cached test results
|
|
uses: actions/cache/restore@v3
|
|
with:
|
|
key: coverage-xml
|
|
path: |
|
|
'${{ github.workspace }}/MewtocolTests/coverage.opencover.xml'
|
|
|
|
- name: 'Upload coverage xml to latest release'
|
|
uses: actions/upload-release-asset@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ github.token }}
|
|
with:
|
|
upload_url: "${{ github.event.release.upload_url }}"
|
|
asset_path: '${{ github.workspace }}/MewtocolTests/coverage.opencover.xml'
|
|
asset_name: coverage.opencover.xml
|
|
asset_content_type: application/xml
|
|
|