diff --git a/.github/workflows/pr_config.yml b/.github/workflows/pr_config.yml new file mode 100644 index 0000000..ed86c13 --- /dev/null +++ b/.github/workflows/pr_config.yml @@ -0,0 +1,28 @@ +on: + pull_request: + paths: + - .github/workflows/pr_config.yml + - config/** + workflow_dispatch: + +jobs: + doc: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3 + + - name: Setup NodeJS + uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3 + with: + cache: 'npm' + cache-dependency-path: docs/src/package-lock.json + node-version-file: docs/src/package.json + + - name: Setup Cue for JSON validation + uses: cue-lang/setup-cue@v1.0.0 + + - name: Validate version.json and flutter_version.json + run: | + cue vet config/version.cue config/version.json + cue vet config/flutter_version.cue config/flutter_version.json diff --git a/.github/workflows/pr_flutter_app.yml b/.github/workflows/pr_flutter_app.yml index 0d1acc8..dc4d5dd 100644 --- a/.github/workflows/pr_flutter_app.yml +++ b/.github/workflows/pr_flutter_app.yml @@ -1,7 +1,7 @@ on: pull_request: paths: - - .github/workflows/pr_integration.yml + - .github/workflows/pr_flutter_app.yml - script/updateAndroidVersions.gradle - version.json workflow_dispatch: @@ -17,7 +17,7 @@ jobs: run: | echo "FLUTTER_VERSION=$(jq -r '.flutter.version' config/version.json)" >> $GITHUB_ENV echo "FLUTTER_CHANNEL=$(jq -r '.flutter.channel' config/version.json)" >> $GITHUB_ENV - + - name: Setup Flutter uses: flutter-actions/setup-flutter@f59ff7bdbb3127f71345907452e04be356c370f5 # v2 with: @@ -34,3 +34,9 @@ jobs: run: | cat ../../script/updateAndroidVersions.gradle >> app/build.gradle ./gradlew --warning-mode all updateAndroidVersions + + - name: Setup Cue for JSON validation + uses: cue-lang/setup-cue@v1.0.0 + + - name: Validate version.json + run: cue vet config/version.cue config/version.json diff --git a/.github/workflows/update_flutter_dependencies.yml b/.github/workflows/update_flutter_dependencies.yml index 1eb411b..ad85b93 100644 --- a/.github/workflows/update_flutter_dependencies.yml +++ b/.github/workflows/update_flutter_dependencies.yml @@ -55,6 +55,12 @@ jobs: run: | rm -rf test_app + - name: Setup Cue for JSON validation + uses: cue-lang/setup-cue@v1.0.0 + + - name: Validate version.json + run: cue vet config/version.cue config/version.json + - name: Setup NodeJS uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3 with: @@ -74,7 +80,7 @@ jobs: - name: Create commit message variable run: | echo "COMMIT_MESSAGE='chore: update dependencies versions in manifest with flutter ${{ env.FLUTTER_VERSION }}'" >> $GITHUB_ENV - + - name: Create pull request if there are changes uses: peter-evans/create-pull-request@153407881ec5c347639a548ade7d8ad1d6740e38 # v5 with: diff --git a/.github/workflows/update_flutter_version.yml b/.github/workflows/update_flutter_version.yml index 21d7158..9ca4652 100644 --- a/.github/workflows/update_flutter_version.yml +++ b/.github/workflows/update_flutter_version.yml @@ -20,6 +20,12 @@ jobs: const script = require('./script/updateFlutterVersion.js') await script({core, fetch}) + - name: Setup Cue for JSON validation + uses: cue-lang/setup-cue@v1.0.0 + + - name: Validate version.json + run: cue vet config/flutter_version.cue config/flutter_version.json + - name: Setup Gitsign to sign git commits uses: chainguard-dev/actions/setup-gitsign@18e5df81d0b217b89d34c477955f18f5745ebbdd # main diff --git a/config/flutter_version.cue b/config/flutter_version.cue new file mode 100644 index 0000000..32af30a --- /dev/null +++ b/config/flutter_version.cue @@ -0,0 +1,12 @@ +import "strings" +import "list" + +#Version3: { + version!: =~ "^\\d+.\\d+.\\d+$" +} + +flutter: { + channel!: "stable" | "beta" + commit!: strings.MaxRunes(40) + #Version3 +} diff --git a/config/version.cue b/config/version.cue new file mode 100644 index 0000000..d52e68f --- /dev/null +++ b/config/version.cue @@ -0,0 +1,25 @@ +import "strings" +import "list" + +#Version2: { + version!: =~ "^\\d+.\\d+$" +} + +#Version3: { + version!: =~ "^\\d+.\\d+.\\d+$" +} + +flutter: { + channel!: "stable" | "beta" + commit!: strings.MaxRunes(40) + #Version3 +} + +android: { + platforms!: [ { version!: int } ] & list.MinItems(1) + gradle!: #Version2 + buildTools!: #Version3 + cmdlineTools!: #Version2 +} + +fastlane!: #Version3