Skip to content

Feature: Deploy API (#16) #40

Feature: Deploy API (#16)

Feature: Deploy API (#16) #40

Workflow file for this run

name: Publish SDK
on:
push:
branches: main
jobs:
check-version:
outputs:
version-exists: ${{ steps.check-version.outputs.version-exists }}
current-version: ${{ steps.check-version.outputs.current-version }}
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- id: check-version
env:
GH_TOKEN: ${{ github.token }}
run: |
sudo apt install xq
version=$(xq Mortein/Mortein.csproj --xpath '/Project/PropertyGroup/FileVersion')
(gh release list --repo deco3801-mortein/backend --json tagName --jq '.[].tagName' \
| (grep --fixed-strings "v${version}" > /dev/null) \
&& echo version-exists=true || echo version-exists=false) >> $GITHUB_OUTPUT
echo current-version=${version} >> $GITHUB_OUTPUT
release-sdk:
environment: deployment
if: ${{ ! fromJson(needs.check-version.outputs.version-exists) }}
needs: check-version
permissions:
contents: write
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
dotnet-version: 8
cache: true
cache-dependency-path: Mortein/packages.lock.json
- run: dotnet restore Mortein/
- run: dotnet tool restore
- uses: actions/setup-node@v4
with:
node-version: "20"
cache: npm
- run: npm clean-install
- run: ./generate-sdk.sh "https://${{ env.SUBDOMAIN }}.${{ env.DOMAIN_NAME }}"
- run: gh release create --generate-notes "v${VERSION}" "mortein-sdk/dist/mortein-sdk-${VERSION}.tgz"
env:
GH_TOKEN: ${{ github.token }}
NODE_AUTH_TOKEN: ${{ secrets.PUBLISH_SDK_PAT }}
VERSION: ${{ needs.check-version.outputs.current-version }}