This repository has been archived by the owner on Mar 4, 2024. It is now read-only.
Update dart-sass #39
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: Update dart-sass | |
on: | |
schedule: | |
- cron: '30 5 * * *' | |
workflow_dispatch: | |
jobs: | |
check-update: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Check newer version | |
id: version-check | |
run: | | |
current_version=$(grep -P '(?<=<Version>).+(?=</Version>)' -o AspNetCore.SassCompiler/AspNetCore.SassCompiler.csproj) | |
latest_version=$(curl -s https://api.github.com/repos/sass/dart-sass/releases/latest | jq '.tag_name' -r) | |
function version { echo "$@" | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }'; } | |
echo "Current version: $current_version" | |
echo "Latest version: $latest_version" | |
if [ $(version $latest_version) -gt $(version $current_version) ]; then | |
echo "Found newer version of dart-sass: $latest_version" | |
if ! git branch -a | grep "dart-sass/$latest_version" >/dev/null ; then | |
echo "sass-version=${latest_version}" >> $GITHUB_OUTPUT | |
else | |
echo "A branch already exists for this version, skipping" | |
fi | |
fi | |
- name: Install dependencies | |
if: success() && steps.version-check.outputs.sass-version != '' | |
env: | |
SASS_VERSION: ${{ steps.version-check.outputs.sass-version }} | |
run: | | |
curl -sL -o dart-sass-linux-x64.tar.gz "https://github.com/sass/dart-sass/releases/download/$SASS_VERSION/dart-sass-$SASS_VERSION-linux-x64.tar.gz" | |
curl -sL -o dart-sass-linux-arm64.tar.gz "https://github.com/sass/dart-sass/releases/download/$SASS_VERSION/dart-sass-$SASS_VERSION-linux-arm64.tar.gz" | |
curl -sL -o dart-sass-osx-x64.tar.gz "https://github.com/sass/dart-sass/releases/download/$SASS_VERSION/dart-sass-$SASS_VERSION-macos-x64.tar.gz" | |
curl -sL -o dart-sass-osx-arm64.tar.gz "https://github.com/sass/dart-sass/releases/download/$SASS_VERSION/dart-sass-$SASS_VERSION-macos-arm64.tar.gz" | |
curl -sL -o dart-sass-win-x64.zip "https://github.com/sass/dart-sass/releases/download/$SASS_VERSION/dart-sass-$SASS_VERSION-windows-x64.zip" | |
rm -rf AspNetCore.SassCompiler/runtimes/ | |
mkdir -p AspNetCore.SassCompiler/runtimes/{linux-x64,linux-arm64,osx-x64,osx-arm64,win-x64} | |
for runtime in "linux-x64" "linux-arm64" "osx-x64" "osx-arm64"; do | |
tar xf "dart-sass-$runtime.tar.gz" | |
mv dart-sass/* "AspNetCore.SassCompiler/runtimes/$runtime/" | |
rm -rf dart-sass | |
done | |
for runtime in "win-x64"; do | |
7z x -bb1 "dart-sass-$runtime.zip" | |
mv dart-sass/* "AspNetCore.SassCompiler/runtimes/$runtime/" | |
rm -rf dart-sass | |
done | |
rm dart-sass-* | |
perl -pi -e "s/(?<=<Version>).+(?=<\/Version>)/$SASS_VERSION/g" AspNetCore.SassCompiler/AspNetCore.SassCompiler.csproj | |
- name: Create Pull Request | |
if: success() && steps.version-check.outputs.sass-version != '' | |
uses: peter-evans/create-pull-request@v4 | |
with: | |
commit-message: Update dart-sass to ${{ steps.version-check.outputs.sass-version }} | |
branch: dart-sass/${{ steps.version-check.outputs.sass-version }} | |
delete-branch: true | |
title: Update dart-sass to ${{ steps.version-check.outputs.sass-version }} | |
body: | | |
Update dart-sass to ${{ steps.version-check.outputs.sass-version }} | |
**Note**: This is an autogenerated PR. | |
token: ${{ secrets.SASSCOMPILER_PR_CREATOR_PAT }} |