Skip to content

2.0.7

2.0.7 #111

Workflow file for this run

# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: publish
on:
workflow_dispatch: # Allow running the workflow manually from the GitHub UI
release:
types:
- published # Run the workflow when a new GitHub release is published
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_NOLOGO: true
NUGET_DIRECTORY: ${{ github.workspace }}/nuget
jobs:
regenerate-sdks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: 'main'
fetch-tags: 'true'
- uses: actions/setup-java@v3
with:
java-version: 17
distribution: 'zulu'
- uses: actions/setup-node@v3
with:
node-version: 20
- name: 📥 dependency installation
uses: ./.github/actions/pnpm-install
- name: Generate SDKs
run: pnpm generate
- name: Set version variable from release tag
run: |
TAG=${{ github.event.release.tag_name }}
echo "VERSION=${TAG#v}" >> $GITHUB_ENV
- name: Update automation node SDK version
working-directory: ./automation-api-clients/typescript-node
run: npm version $VERSION --allow-same-version --no-git-tag-version
- name: Update player node SDK version
working-directory: ./player-api-clients/typescript-node
run: npm version $VERSION --allow-same-version --no-git-tag-version
- name: Update main and fast-foward tag
run: |
# set credentials to github-actions so we know it's automated
git config user.name github-actions
git config user.email github-actions@github.com
# stage all files and make a release commit
git add -A
git commit -m "[RELEASE] ${{ github.event.release.tag_name }}" --allow-empty
# push release commit to main
git push
## override existing tag to point at new commit, with code that we actually package
git tag -f ${{ github.event.release.tag_name }}
git push --tags --force
deploy-npm-package:
if: github.event_name == 'release'
runs-on: ubuntu-latest
needs: [regenerate-sdks]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: 'main'
fetch-tags: 'true'
- uses: actions/setup-node@v3
with:
node-version: 20
registry-url: 'https://registry.npmjs.org'
- name: 📥 dependency installation
uses: ./.github/actions/pnpm-install
- run: pnpm generate
working-directory: ./automation-api-clients/typescript-node
- run: pnpm generate
working-directory: ./player-api-clients/typescript-node
- run: pnpm publish --no-git-checks --access public
working-directory: ./automation-api-clients/typescript-node
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- run: pnpm publish --no-git-checks --access public
working-directory: ./player-api-clients/typescript-node
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
create-nuget:
runs-on: ubuntu-latest
needs: [regenerate-sdks]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: 'main'
fetch-tags: 'true'
# Install the .NET SDK indicated in the global.json file
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '7'
dotnet-quality: 'ga'
- name: Set version variable from release tag
run: |
TAG=${{ github.event.release.tag_name }}
echo "VERSION=${TAG#v}" >> $GITHUB_ENV
# Create the NuGet package in the folder from the environment variable NUGET_DIRECTORY
- run: dotnet pack ./automation-api-clients/csharp/BeamAutomationClient.sln --output ${{ env.NUGET_DIRECTORY }}
# Create the NuGet package in the folder from the environment variable NUGET_DIRECTORY
- run: dotnet pack ./player-api-clients/csharp/BeamPlayerClient.sln --output ${{ env.NUGET_DIRECTORY }}
# Publish the NuGet package as an artifact, so they can be used in the following jobs
- uses: actions/upload-artifact@v3
with:
name: nuget
if-no-files-found: error
retention-days: 7
path: ${{ env.NUGET_DIRECTORY }}/*.nupkg
deploy-nuget:
# Publish only when creating a GitHub Release
# https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository
# You can update this logic if you want to manage releases differently
if: github.event_name == 'release'
runs-on: ubuntu-latest
needs: [ create-nuget ]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: 'main'
fetch-tags: 'true'
# Install the .NET SDK indicated in the global.json file
- uses: actions/setup-dotnet@v3
# Download the NuGet package created in the previous job
- uses: actions/download-artifact@v3
with:
name: nuget
path: ${{ env.NUGET_DIRECTORY }}
# Publish all NuGet packages to NuGet.org
# Use --skip-duplicate to prevent errors if a package with the same version already exists.
# If you retry a failed workflow, already published packages will be skipped without error.
- name: Publish NuGet package
run: dotnet nuget push **/*.nupkg --api-key "${{ secrets.NUGET_APIKEY }}" --source https://api.nuget.org/v3/index.json --skip-duplicate