Check for VS releases #492
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: Check for VS releases | |
on: | |
schedule: | |
- cron: '0 0 * * *' | |
workflow_dispatch: | |
jobs: | |
check_vs_versions: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check for new VS versions | |
run: | | |
#!/usr/bin/env bash | |
# don't exit script on error | |
set +e | |
function get-latest-vs-release { | |
curl -s --location "https://aka.ms/vs/$1/release/channel" | jq -r -e '.info.productDisplayVersion' | |
} | |
function check-vs-release { | |
LATEST_RELEASE=$(get-latest-vs-release $1) | |
docker manifest inspect ghcr.io/rektinator/msbuild-docker:$LATEST_RELEASE > /dev/null | |
if [ $? -ne 0 ]; | |
then | |
# new release detected, trigger build action | |
echo "Detected new VS version $LATEST_RELEASE, triggering build!" | |
curl -s -X POST -H "Accept: application/vnd.github.v3+json" -u rektinator:${{ secrets.WORKFLOW_TOKEN }} https://api.github.com/repos/rektinator/msbuild-docker/actions/workflows/build.yml/dispatches -d "{\"ref\":\"main\", \"inputs\": {\"vs_version\": \"$1\"}}" > /dev/null | |
fi | |
} | |
check-vs-release 16 | |
check-vs-release 17 |