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: Set .csproj version to ${{github.ref_name}} run: | VERSION=${{ github.ref_name }} echo "VERSION=${VERSION:1}" >> $GITHUB_ENV sed -i 's/[0-9].[0-9].[0-9]<\/Version>/${{ env.VERSION }}<\/Version>/g' 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 run: dotnet build "MewtocolNet" - name: Pack run: dotnet pack "MewtocolNet" - name: Publish run: | cd '${{ github.workspace }}/Builds' dotnet nuget push "*.nupkg" --skip-duplicate --api-key ${{ secrets.GITHUB_TOKEN }} --source "https://nuget.pkg.github.com/WOmed/index.json" - name: 'Upload artifacts 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