Skip to content

Commit

Permalink
fix workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
Joshix-1 committed Sep 20, 2024
1 parent 18a7d40 commit 9271379
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 278 deletions.
13 changes: 0 additions & 13 deletions .github/workflows/build-android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,6 @@ jobs:
lib: lib
runner: ubuntu-latest
platform: linux/amd64
- arch: arm64
lib: lib64
runner: linux-arm64
platform: linux/arm64
- arch: arm
lib: lib
runner: linux-arm64
platform: linux/arm64
# There is no docker image for riscv64 dart-sdk, build kernel snapshot instead.
- arch: riscv64
lib: lib64
runner: ubuntu-latest
platform: linux/amd64 # linux/riscv64

steps:
- uses: actions/checkout@v4
Expand Down
6 changes: 0 additions & 6 deletions .github/workflows/build-linux-musl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,6 @@ jobs:
- arch: ia32
runner: ubuntu-latest
platform: linux/amd64
- arch: arm64
runner: linux-arm64
platform: linux/arm64
- arch: arm
runner: linux-arm64
platform: linux/arm/v7
- arch: riscv64
runner: ubuntu-latest
platform: linux/riscv64
Expand Down
6 changes: 0 additions & 6 deletions .github/workflows/build-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,6 @@ jobs:
- arch: ia32
runner: ubuntu-latest
platform: linux/amd64
- arch: arm64
runner: linux-arm64
platform: linux/arm64
- arch: arm
runner: linux-arm64
platform: linux/arm/v7
- arch: riscv64
runner: ubuntu-latest
platform: linux/riscv64
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/build-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ jobs:
runner: windows-latest
- arch: ia32
runner: windows-latest
- arch: arm64
runner: windows-arm64

steps:
- uses: actions/checkout@v4
Expand Down
11 changes: 3 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,20 @@ jobs:
name: Double-check
runs-on: ubuntu-latest
needs: [test]
if: "startsWith(github.ref, 'refs/tags/') && github.event.repository.fork == false"
if: "startsWith(github.ref, 'refs/tags/')"

steps:
- uses: actions/checkout@v4
- uses: ./.github/util/initialize
with: {github-token: "${{ github.token }}"}

- name: Run checks
run: dart run grinder double-check-before-release

test_vendor:
needs: [double_check]
if: "startsWith(github.ref, 'refs/tags/') && github.event.repository.fork == false"
if: "startsWith(github.ref, 'refs/tags/')"
uses: ./.github/workflows/test-vendor.yml
secrets: inherit

release:
needs: [test_vendor]
if: "startsWith(github.ref, 'refs/tags/') && github.event.repository.fork == false"
if: "startsWith(github.ref, 'refs/tags/')"
permissions:
contents: write
uses: ./.github/workflows/release.yml
Expand Down
201 changes: 2 additions & 199 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ jobs:
- name: Deploy
run: dart run grinder pkg-github-release
env:
GH_TOKEN: "${{ secrets.GH_TOKEN }}"
GH_USER: sassbot
GH_TOKEN: "${{ github.token }}"
GH_USER: "${{ github.actor }}"

deploy_github:
name: Deploy Github
Expand All @@ -57,200 +57,3 @@ jobs:
with:
files: |
build-*/*
deploy_npm:
name: Deploy npm
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: ./.github/util/initialize
with: {github-token: "${{ github.token }}"}

- name: Deploy
run: dart run grinder pkg-npm-deploy
env:
UPDATE_SASS_SASS_REPO: false
NPM_TOKEN: "${{ secrets.NPM_TOKEN }}"

deploy_bazel:
name: Deploy Bazel
runs-on: ubuntu-latest
needs: [deploy_npm]

steps:
- uses: actions/checkout@v4
- uses: ./.github/util/initialize
with: {github-token: "${{ github.token }}"}

- name: Deploy
run: dart run grinder update-bazel
env:
GH_TOKEN: "${{ secrets.GH_TOKEN }}"
GH_USER: sassbot

deploy_pub:
name: Deploy Pub
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: ./.github/util/initialize
with: {github-token: "${{ github.token }}"}

- name: Deploy
run: dart run grinder protobuf pkg-pub-deploy
env: {PUB_CREDENTIALS: "${{ secrets.PUB_CREDENTIALS }}"}

deploy_sass_api:
name: Deploy sass_api
runs-on: ubuntu-latest
needs: [deploy_pub]

steps:
- uses: actions/checkout@v4
- uses: ./.github/util/initialize
with: {github-token: "${{ github.token }}"}

- name: Deploy
run: dart run grinder deploy-sass-api
env:
PUB_CREDENTIALS: "${{ secrets.PUB_CREDENTIALS }}"
GH_TOKEN: "${{ secrets.GH_TOKEN }}"
GH_USER: sassbot

deploy_sass_parser:
name: Deploy sass-parser
runs-on: ubuntu-latest
needs: [deploy_npm]

steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GH_TOKEN }}
# Set up .npmrc file to publish to npm
- uses: actions/setup-node@v4
with:
version: 'lts/*'
check-latest: true
registry-url: 'https://registry.npmjs.org'

# The repo package has a file dependency, but the released version needs
# a real dependency on the released version of Sass.
- run: npm install sass@${{ steps.version.outputs.version }}
working-directory: pkg/sass-parser/

- run: npm publish
env:
NODE_AUTH_TOKEN: '${{ secrets.NPM_TOKEN }}'
working-directory: pkg/sass-parser/

- name: Get version
id: version
run: |
echo "version=$(jq .version pkg/sass-parser/package.json)" | tee --append "$GITHUB_OUTPUT"
- run: git tag sass-parser/${{ steps.version.outputs.version }}
- run: git push --tag

deploy_homebrew:
name: Deploy Homebrew
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: dart-lang/setup-dart@v1
- run: dart pub get

- name: Deploy
run: dart run grinder pkg-homebrew-update
env:
GH_TOKEN: "${{ secrets.GH_TOKEN }}"
GH_USER: sassbot

deploy_chocolatey:
name: Deploy Chocolatey
runs-on: windows-latest

steps:
- uses: actions/checkout@v4
- uses: ./.github/util/initialize
with: {github-token: "${{ github.token }}"}

- name: Deploy
run: dart run grinder pkg-chocolatey-deploy
env: {CHOCOLATEY_TOKEN: "${{ secrets.CHOCOLATEY_TOKEN }}"}

deploy_website:
name: Deploy sass-lang.com
runs-on: ubuntu-latest
needs: [deploy_npm]

steps:
- uses: actions/checkout@v4
with:
repository: sass/sass-site
token: ${{ secrets.SASS_SITE_TOKEN }}

- name: Get version
id: version
run: echo "version=${GITHUB_REF##*/}" | tee --append "$GITHUB_OUTPUT"

- name: Wait for npm registry's CDN to catch up on replications
run: sleep 600

- name: Update Dart Sass version
run: npm install sass@${{ steps.version.outputs.version }}

- uses: EndBug/add-and-commit@v9
with:
author_name: Sass Bot
author_email: [email protected]
message: Cut a release for a new Dart Sass version
commit: --allow-empty

release_embedded_host:
name: Release Embedded Host
runs-on: ubuntu-latest
needs: [deploy_github]

steps:
- uses: actions/checkout@v4
with:
repository: sass/embedded-host-node
token: ${{ secrets.GH_TOKEN }}

- name: Get version
id: version
run: |
echo "version=${GITHUB_REF##*/}" | tee --append "$GITHUB_OUTPUT"
echo "protocol_version=$(curl -fsSL -H "Authorization: Bearer ${{ github.token }}" https://raw.githubusercontent.com/sass/sass/HEAD/spec/EMBEDDED_PROTOCOL_VERSION)" | tee --append "$GITHUB_OUTPUT"
- name: Update version
run: |
# Update binary package versions
for dir in $(ls npm); do
cat "npm/$dir/package.json" |
jq --arg version ${{ steps.version.outputs.version }} '
.version |= $version
' > package.json.tmp &&
mv package.json.tmp "npm/$dir/package.json"
done
# Update main package version and dependencies on binary packages
cat package.json |
jq --arg version ${{ steps.version.outputs.version }} --arg protocol_version ${{ steps.version.outputs.protocol_version }} '
.version |= $version |
."compiler-version" |= $version |
."protocol-version" |= $protocol_version |
.optionalDependencies = (.optionalDependencies | .[] |= $version)
' > package.json.tmp &&
mv package.json.tmp package.json
curl -fsSL -H "Authorization: Bearer ${{ github.token }}" https://raw.githubusercontent.com/sass/dart-sass/${{ steps.version.outputs.version }}/CHANGELOG.md > CHANGELOG.md
shell: bash

- uses: EndBug/add-and-commit@v9
with:
author_name: Sass Bot
author_email: [email protected]
message: Update Dart Sass version and release
tag: ${{ steps.version.outputs.version }}
45 changes: 1 addition & 44 deletions tool/grind/double_check.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,50 +2,7 @@
// MIT-style license that can be found in the LICENSE file or at
// https://opensource.org/licenses/MIT.

import 'dart:io';

import 'package:cli_pkg/cli_pkg.dart' as pkg;
import 'package:collection/collection.dart';
import 'package:grinder/grinder.dart';
import 'package:pub_api_client/pub_api_client.dart';
import 'package:pubspec_parse/pubspec_parse.dart';

import 'utils.dart';

@Task('Verify that the package is in a good state to release.')
Future<void> doubleCheckBeforeRelease() async {
var ref = environment("GITHUB_REF");
if (ref != "refs/tags/${pkg.version}") {
fail("GITHUB_REF $ref is different than pubspec version ${pkg.version}.");
}

if (const ListEquality<Object?>().equals(pkg.version.preRelease, ["dev"])) {
fail("${pkg.version} is a dev release.");
}

var versionHeader =
RegExp("^## ${RegExp.escape(pkg.version.toString())}\$", multiLine: true);
if (!File("CHANGELOG.md").readAsStringSync().contains(versionHeader)) {
fail("There's no CHANGELOG entry for ${pkg.version}.");
}

var client = PubClient();
try {
for (var dir in [
".",
...Directory("pkg").listSync().map((entry) => entry.path)
]) {
var pubspecFile = File("$dir/pubspec.yaml");
if (!pubspecFile.existsSync()) continue;
var pubspec = Pubspec.parse(pubspecFile.readAsStringSync(),
sourceUrl: pubspecFile.uri);

var package = await client.packageInfo(pubspec.name);
if (pubspec.version == package.latestPubspec.version) {
fail("${pubspec.name} ${pubspec.version} has already been released!");
}
}
} finally {
client.close();
}
}
Future<void> doubleCheckBeforeRelease() async {}

0 comments on commit 9271379

Please sign in to comment.