mirror of
https://github.com/gradle/actions.git
synced 2025-04-21 18:29:18 +08:00
Auto-update 'dist' directory on push to 'main'
This commit is contained in:
parent
63fcfbfe27
commit
6814b629bf
3
.github/actions/build-dist/action.yml
vendored
3
.github/actions/build-dist/action.yml
vendored
@ -6,6 +6,9 @@ runs:
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
cache: npm
|
||||
cache-dependency-path: sources/package-lock.json
|
||||
|
||||
- name: Build distribution
|
||||
shell: bash
|
||||
run: |
|
||||
|
26
.github/workflows/ci-check-no-dist-update.yml
vendored
Normal file
26
.github/workflows/ci-check-no-dist-update.yml
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
name: CI-check-no-dist-update
|
||||
|
||||
# Will run on any change to 'dist/**' on a non-release branch
|
||||
on:
|
||||
push:
|
||||
branches-ignore:
|
||||
- main
|
||||
- release/*
|
||||
paths:
|
||||
- dist**
|
||||
pull_request:
|
||||
paths:
|
||||
- dist/**
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
fail-on-dist-update:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- run: |
|
||||
echo "The 'dist' directory is auotmatically updated by the release process."
|
||||
echo "It should not be updated manually in a non-release branch or a pull request."
|
||||
exit 1
|
28
.github/workflows/ci-dependency-review.yml
vendored
28
.github/workflows/ci-dependency-review.yml
vendored
@ -1,28 +0,0 @@
|
||||
# Dependency Review Action
|
||||
#
|
||||
# This Action will scan dependency manifest files that change as part of a Pull Request, surfacing known-vulnerable versions of the packages declared or updated in the PR. Once installed, if the workflow run is marked as required, PRs introducing known-vulnerable packages will be blocked from merging.
|
||||
#
|
||||
# Source repository: https://github.com/actions/dependency-review-action
|
||||
# Public documentation: https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/about-dependency-review#dependency-review-enforcement
|
||||
name: CI-dependency-review
|
||||
on: [pull_request]
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
dependency-review:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: 'Checkout Repository'
|
||||
uses: actions/checkout@v4
|
||||
- name: Dependencies for groovy-dsl
|
||||
uses: ./dependency-submission
|
||||
with:
|
||||
build-root-directory: .github/workflow-samples/groovy-dsl
|
||||
- name: Dependencies for kotlin-dsl
|
||||
uses: ./dependency-submission
|
||||
with:
|
||||
build-root-directory: .github/workflow-samples/kotlin-dsl
|
||||
- name: 'Dependency Review'
|
||||
uses: actions/dependency-review-action@v4
|
29
.github/workflows/ci-format-and-unit-test.yml
vendored
Normal file
29
.github/workflows/ci-format-and-unit-test.yml
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
name: CI-format-and-unit-test
|
||||
|
||||
on:
|
||||
push:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
check-format-and-unit-test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
cache: npm
|
||||
cache-dependency-path: sources/package-lock.json
|
||||
|
||||
- name: Build and check formatting
|
||||
run: |
|
||||
npm install
|
||||
npm run build-ci
|
||||
working-directory: sources
|
||||
- name: Run unit tests
|
||||
run: |
|
||||
npm test
|
||||
working-directory: sources
|
6
.github/workflows/ci-full-check.yml
vendored
6
.github/workflows/ci-full-check.yml
vendored
@ -2,18 +2,12 @@ name: CI-full-check
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
types:
|
||||
- assigned
|
||||
- review_requested
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- release/**
|
||||
paths:
|
||||
- '.github/**'
|
||||
- 'dist/**'
|
||||
- '**/action.yml'
|
||||
|
||||
jobs:
|
||||
action-inputs:
|
||||
|
18
.github/workflows/ci-quick-check.yml
vendored
18
.github/workflows/ci-quick-check.yml
vendored
@ -3,9 +3,6 @@ name: CI-quick-check
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches-ignore:
|
||||
- main
|
||||
- release/**
|
||||
|
||||
jobs:
|
||||
build-distribution:
|
||||
@ -16,21 +13,6 @@ jobs:
|
||||
- name: Build and upload distribution
|
||||
uses: ./.github/actions/build-dist
|
||||
|
||||
run-unit-tests:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v4
|
||||
- name: Configure Gradle as default for unit test
|
||||
uses: ./setup-gradle
|
||||
with:
|
||||
gradle-version: 8.7
|
||||
- name: Run tests
|
||||
run: |
|
||||
npm install
|
||||
npm run all
|
||||
working-directory: sources
|
||||
|
||||
action-inputs:
|
||||
needs: build-distribution
|
||||
uses: ./.github/workflows/integ-test-action-inputs.yml
|
||||
|
49
.github/workflows/ci-update-dist.yml
vendored
Normal file
49
.github/workflows/ci-update-dist.yml
vendored
Normal file
@ -0,0 +1,49 @@
|
||||
name: CI-update-dist
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- release/**
|
||||
paths-ignore:
|
||||
- 'dist/**'
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
update-dist:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
cache: npm
|
||||
cache-dependency-path: sources/package-lock.json
|
||||
|
||||
- name: Build distribution
|
||||
run: |
|
||||
npm clean-install
|
||||
npm run build-ci
|
||||
working-directory: sources
|
||||
|
||||
- name: Copy the generated sources/dist directory to the top-level dist
|
||||
run: |
|
||||
cp -r sources/dist .
|
||||
|
||||
# Commit and push changes; has no effect if the files did not change
|
||||
# Important: The push event will not trigger any other workflows, see
|
||||
# https://github.com/stefanzweifel/git-auto-commit-action?tab=readme-ov-file#commits-made-by-this-action-do-not-trigger-new-workflow-runs
|
||||
- name: Commit & push changes
|
||||
# Only run for the Gradle repository; otherwise when users create pull requests from their `main` branch
|
||||
# it would erroneously update `dist` on their branch (and the pull request)
|
||||
if: github.repository == 'gradle/actions'
|
||||
uses: stefanzweifel/git-auto-commit-action@v5
|
||||
with:
|
||||
commit_message: 'Update dist directory'
|
||||
file_pattern: dist
|
45
.github/workflows/ci-verify-outputs.yml
vendored
45
.github/workflows/ci-verify-outputs.yml
vendored
@ -1,45 +0,0 @@
|
||||
name: CI-verify-outputs
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types:
|
||||
- assigned
|
||||
- review_requested
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- release/**
|
||||
- dependabot/**
|
||||
|
||||
jobs:
|
||||
check:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout sources
|
||||
uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
- name: Build
|
||||
run: |
|
||||
npm -v
|
||||
node -v
|
||||
npm install
|
||||
npm run build
|
||||
working-directory: sources
|
||||
|
||||
- name: Compare the expected and actual dist/ directories
|
||||
run: |
|
||||
if [ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then
|
||||
echo "Detected uncommitted changes after build. See status below:"
|
||||
git diff
|
||||
exit 1
|
||||
fi
|
||||
id: diff
|
||||
|
||||
# If index.js was different than expected, upload the expected version as an artifact
|
||||
- uses: actions/upload-artifact@v4
|
||||
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
|
||||
with:
|
||||
name: dist
|
||||
path: dist/
|
2
sources/.gitignore
vendored
2
sources/.gitignore
vendored
@ -102,3 +102,5 @@ __tests__/runner/*
|
||||
.idea/
|
||||
*.iml
|
||||
|
||||
# Local 'dist' directory within 'sources'. This is copied to ../dist by CI.
|
||||
dist/
|
||||
|
@ -5,17 +5,19 @@
|
||||
"description": "Execute Gradle Build",
|
||||
"scripts": {
|
||||
"postinstall": "patch-package",
|
||||
"format": "prettier --write 'src/**/*.ts'",
|
||||
"format-check": "prettier --check 'src/**/*.ts'",
|
||||
"prettier-write": "prettier --write 'src/**/*.ts'",
|
||||
"prettier-check": "prettier --check 'src/**/*.ts'",
|
||||
"lint": "eslint 'src/**/*.ts'",
|
||||
"compile-dependency-submission-main": "ncc build src/dependency-submission/main.ts --out ../dist/dependency-submission/main --source-map --no-source-map-register",
|
||||
"compile-dependency-submission-post": "ncc build src/dependency-submission/post.ts --out ../dist/dependency-submission/post --source-map --no-source-map-register",
|
||||
"compile-setup-gradle-main": "ncc build src/setup-gradle/main.ts --out ../dist/setup-gradle/main --source-map --no-source-map-register",
|
||||
"compile-setup-gradle-post": "ncc build src/setup-gradle/post.ts --out ../dist/setup-gradle/post --source-map --no-source-map-register",
|
||||
"compile-dependency-submission-main": "ncc build src/dependency-submission/main.ts --out dist/dependency-submission/main --source-map --no-source-map-register",
|
||||
"compile-dependency-submission-post": "ncc build src/dependency-submission/post.ts --out dist/dependency-submission/post --source-map --no-source-map-register",
|
||||
"compile-setup-gradle-main": "ncc build src/setup-gradle/main.ts --out dist/setup-gradle/main --source-map --no-source-map-register",
|
||||
"compile-setup-gradle-post": "ncc build src/setup-gradle/post.ts --out dist/setup-gradle/post --source-map --no-source-map-register",
|
||||
"compile": "npm-run-all --parallel compile-*",
|
||||
"check": "npm-run-all --parallel format lint",
|
||||
"check": "npm-run-all --parallel prettier-check lint",
|
||||
"format": "npm-run-all --parallel prettier-write lint",
|
||||
"test": "jest",
|
||||
"build": "npm run check && npm run compile",
|
||||
"build": "npm run format && npm run compile",
|
||||
"build-ci": "npm run check && npm run compile",
|
||||
"all": "npm run build && npm test"
|
||||
},
|
||||
"repository": {
|
||||
|
Loading…
x
Reference in New Issue
Block a user