Cmf.CustomerPortal.Sdk v1.14.21 #68
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: Publish NPM Package on Release | |
on: | |
release: | |
types: [published] | |
jobs: | |
BuildAndPublish: | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout | |
- name: Git checkout | |
uses: actions/checkout@v2 | |
# Needs .NET | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: 8.0.x | |
# Run build | |
- name: Build Windows | |
env: | |
DOTNET_CLI_TELEMETRY_OPTOUT: true | |
run: dotnet publish --configuration Release --self-contained --runtime win-x64 Cmf.CustomerPortal.Sdk.sln | |
- name: Build Linux | |
env: | |
DOTNET_CLI_TELEMETRY_OPTOUT: true | |
run: dotnet publish --configuration Release --self-contained --runtime linux-x64 Cmf.CustomerPortal.Sdk.sln | |
# Read version | |
- name: Read tool version | |
uses: QwerMike/xpath-action@v1 | |
id: getver | |
with: | |
filename: src/Version.props | |
expression: '/Project/PropertyGroup/Version/text()' | |
# Needs zip | |
- name: Install zip | |
uses: montudor/[email protected] | |
# Generate packs | |
- name: Archive Console Win64 | |
run: zip -X -r ../../../../../../../Cmf.CustomerPortal.Sdk.Console-${{ steps.getver.outputs.result }}.win-x64.zip . | |
working-directory: src/Console/bin/Release/net8.0/win-x64/publish/ | |
- name: Archive Console Linux64 | |
run: zip -X -r ../../../../../../../Cmf.CustomerPortal.Sdk.Console-${{ steps.getver.outputs.result }}.linux-x64.zip . | |
working-directory: src/Console/bin/Release/net8.0/linux-x64/publish/ | |
- name: Archive PowerShell | |
run: zip -X -r ../../../../../../../Cmf.CustomerPortal.Sdk.PowerShell-${{ steps.getver.outputs.result }}.zip . | |
working-directory: src/Powershell/bin/Release/net8.0/linux-x64/publish/ | |
# Add to release assets | |
- name: Add Console Win64 to Release assets | |
uses: JasonEtco/upload-to-release@master | |
with: | |
args: "Cmf.CustomerPortal.Sdk.Console-${{ steps.getver.outputs.result }}.win-x64.zip application/zip" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Add Console Linux64 to Release assets | |
uses: JasonEtco/upload-to-release@master | |
with: | |
args: "Cmf.CustomerPortal.Sdk.Console-${{ steps.getver.outputs.result }}.linux-x64.zip application/zip" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Add PowerShell to Release assets | |
uses: JasonEtco/upload-to-release@master | |
with: | |
args: "Cmf.CustomerPortal.Sdk.PowerShell-${{ steps.getver.outputs.result }}.zip application/zip" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Add Console Linux64 to Nexus Repository | |
run: curl -v --user "tfsproductbuild:${{secrets.CRITICALMANUFACTURING_IO_TOKEN}}" --upload-file Cmf.CustomerPortal.Sdk.Console-${{ steps.getver.outputs.result }}.linux-x64.zip https://criticalmanufacturing.io/repository/tools/Cmf.CustomerPortal.Sdk.Console-${{ steps.getver.outputs.result }}.linux-x64.zip | |
# Replace Version token on NPM package.json | |
- name: Replace package.json Version token | |
run: cd npm && sed -i ''s/#{Version}#/${{ steps.getver.outputs.result }}/g'' package.json | |
# Replace Version token on NPM install.js | |
- name: Replace install.js Version token | |
run: cd npm && sed -i ''s/#{Version}#/${{ github.ref_name }}/g'' install.js | |
# Setup Node.js environment | |
- name: Setup Node.js environment | |
uses: actions/[email protected] | |
with: | |
node-version: '12.x' | |
registry-url: 'https://registry.npmjs.org' | |
# Publish NPM package (if pre-release) | |
- name: Publish pre-release NPM package | |
run: cd npm && npm publish --tag next | |
if: "github.event.release.prerelease" | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
# Publish NPM package (if regular release) | |
- name: Publish NPM package | |
run: cd npm && npm publish --tag latest && npm dist-tag add @criticalmanufacturing/portal@${{ steps.getver.outputs.result }} next | |
if: "!github.event.release.prerelease" | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |