name: Publish packages on: push: tags: - "v*" # only run when a new package version is tagged workflow_dispatch: inputs: ignoreNpmErrors: description: "Whether to continue the workflow if the npm package publish fails or not. Useful when the npm package already exists." required: false default: "false" jobs: build-ubuntu: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v3 - name: Setup node uses: actions/setup-node@v3 with: node-version: 20 registry-url: "https://registry.npmjs.org" - name: Install .NET SDK uses: actions/setup-dotnet@v3 with: dotnet-version: "8.0.x" # latest LTS build - name: Install npm dependencies run: npm ci - name: Build and push package to npm continue-on-error: ${{ inputs.ignoreNpmErrors == 'true' }} env: FIGMA_ACCESS_TOKEN: ${{ secrets.FIGMA_ACCESS_TOKEN }} NODE_AUTH_TOKEN: ${{ secrets.NPM_API_KEY }} run: | if [[ ${{ github.ref }} == *"rc"* ]]; then npm publish --tag rc else npm publish --tag latest fi - name: .NET Build run: npm run pack:nuget - name: Push package to nuget run: dotnet nuget push **\*.nupkg --source 'https://api.nuget.org/v3/index.json' --api-key ${{secrets.NUGET_API_KEY}} --skip-duplicate - name: Build renamed package for Cloudsmith run: dotnet pack -c Release ./dotnet/src/StackExchange.StacksIcons.csproj /p:PackageId=StackExchange.StacksIcons.Legacy /p:AssemblyName=StackExchange.StacksIcons.Legacy /p:RootNamespace=StackExchange.StacksIcons.Legacy - name: Push package to Cloudsmith run: dotnet nuget push **\StackExchange.StacksIcons.Legacy.*.nupkg --source https://nuget.stackoverflow.software/v3/index.json --api-key ${{secrets.CLOUDSMITH_API_KEY}} --skip-duplicate