mirror of
https://github.com/super-linter/super-linter.git
synced 2024-11-21 16:21:00 -05:00
ci: configure release-please dry-run and changelog (#5039)
- Implement a job to preview the release notes - Include build, ci, and dependency updates - Add emoji to section headings to match the existing release notes - Add documentation about how to run release-please from the CLI
This commit is contained in:
parent
0bb35c3e60
commit
641c65a8c4
12 changed files with 1224 additions and 30 deletions
|
@ -1,5 +1,31 @@
|
||||||
{
|
{
|
||||||
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
|
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
|
||||||
|
"changelog-sections": [
|
||||||
|
{
|
||||||
|
"section": "⬆️ Dependency updates",
|
||||||
|
"type": "deps"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"section": "🚀 Features",
|
||||||
|
"type": "feat"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"section": "🐛 Bug fixes",
|
||||||
|
"type": "fix"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"section": "🧰 Maintenance",
|
||||||
|
"type": "build"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"section": "🧰 Maintenance",
|
||||||
|
"type": "chore"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"section": "🧰 Maintenance",
|
||||||
|
"type": "ci"
|
||||||
|
}
|
||||||
|
],
|
||||||
"packages": {
|
"packages": {
|
||||||
".": {
|
".": {
|
||||||
"changelog-path": "CHANGELOG.md",
|
"changelog-path": "CHANGELOG.md",
|
||||||
|
|
16
.github/workflows/ci.yml
vendored
16
.github/workflows/ci.yml
vendored
|
@ -114,3 +114,19 @@ jobs:
|
||||||
|
|
||||||
- name: Run Test Suite
|
- name: Run Test Suite
|
||||||
run: make test
|
run: make test
|
||||||
|
|
||||||
|
preview-release-notes:
|
||||||
|
if: github.event_name == 'pull_request'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Setup authentication token
|
||||||
|
run: |
|
||||||
|
echo "${{ secrets.GITHUB_TOKEN }}" > .github-personal-access-token
|
||||||
|
|
||||||
|
- name: Generate a preview of the release notes
|
||||||
|
run: |
|
||||||
|
make release-please-dry-run
|
||||||
|
|
0
CHANGELOG.md
Normal file
0
CHANGELOG.md
Normal file
45
Makefile
45
Makefile
|
@ -73,9 +73,20 @@ endif
|
||||||
|
|
||||||
GITHUB_TOKEN_PATH := "$(CURDIR)/.github-personal-access-token"
|
GITHUB_TOKEN_PATH := "$(CURDIR)/.github-personal-access-token"
|
||||||
|
|
||||||
COMMIT_LINTER_CONTAINER_URL := "conventional-changelog/commitlint:latest"
|
DEV_CONTAINER_URL := "super-linter/dev-container:latest"
|
||||||
|
|
||||||
.PHONY: inspec
|
|
||||||
|
ifeq ($(GITHUB_HEAD_REF),)
|
||||||
|
RELEASE_PLEASE_TARGET_BRANCH := "$(shell git branch --show-current)"
|
||||||
|
else
|
||||||
|
RELEASE_PLEASE_TARGET_BRANCH := "${GITHUB_HEAD_REF}"
|
||||||
|
endif
|
||||||
|
|
||||||
|
.phony: check-github-token
|
||||||
|
check-github-token:
|
||||||
|
@if [ ! -f "${GITHUB_TOKEN_PATH}" ]; then echo "Cannot find the file to load the GitHub access token: $(GITHUB_TOKEN_PATH). Create a readable file there, and populate it with a GitHub personal access token."; exit 1; fi
|
||||||
|
|
||||||
|
.phony: inspec
|
||||||
inspec: inspec-check ## Run InSpec tests
|
inspec: inspec-check ## Run InSpec tests
|
||||||
DOCKER_CONTAINER_STATE="$$(docker inspect --format "{{.State.Running}}" $(SUPER_LINTER_TEST_CONTAINER_NAME) 2>/dev/null || echo "")"; \
|
DOCKER_CONTAINER_STATE="$$(docker inspect --format "{{.State.Running}}" $(SUPER_LINTER_TEST_CONTAINER_NAME) 2>/dev/null || echo "")"; \
|
||||||
if [ "$$DOCKER_CONTAINER_STATE" = "true" ]; then docker kill $(SUPER_LINTER_TEST_CONTAINER_NAME); fi && \
|
if [ "$$DOCKER_CONTAINER_STATE" = "true" ]; then docker kill $(SUPER_LINTER_TEST_CONTAINER_NAME); fi && \
|
||||||
|
@ -96,8 +107,7 @@ inspec: inspec-check ## Run InSpec tests
|
||||||
&& docker kill $(SUPER_LINTER_TEST_CONTAINER_NAME)
|
&& docker kill $(SUPER_LINTER_TEST_CONTAINER_NAME)
|
||||||
|
|
||||||
.phony: docker
|
.phony: docker
|
||||||
docker: ## Build the container image
|
docker: check-github-token ## Build the container image
|
||||||
@if [ ! -f "${GITHUB_TOKEN_PATH}" ]; then echo "Cannot find the file to load the GitHub access token: $(GITHUB_TOKEN_PATH). Create a readable file there, and populate it with a GitHub personal access token."; exit 1; fi
|
|
||||||
DOCKER_BUILDKIT=1 docker buildx build --load \
|
DOCKER_BUILDKIT=1 docker buildx build --load \
|
||||||
--build-arg BUILD_DATE=$(BUILD_DATE) \
|
--build-arg BUILD_DATE=$(BUILD_DATE) \
|
||||||
--build-arg BUILD_REVISION=$(BUILD_REVISION) \
|
--build-arg BUILD_REVISION=$(BUILD_REVISION) \
|
||||||
|
@ -157,18 +167,35 @@ test-linters: ## Run the linters test suite
|
||||||
-v "$(CURDIR):/tmp/lint" \
|
-v "$(CURDIR):/tmp/lint" \
|
||||||
$(SUPER_LINTER_TEST_CONTAINER_URL)
|
$(SUPER_LINTER_TEST_CONTAINER_URL)
|
||||||
|
|
||||||
.phony: build-commit-linter-container-image
|
.phony: build-dev-container-image
|
||||||
build-commit-linter-container-image: ## Build commit linter container image
|
build-dev-container-image: ## Build commit linter container image
|
||||||
DOCKER_BUILDKIT=1 docker buildx build --load \
|
DOCKER_BUILDKIT=1 docker buildx build --load \
|
||||||
-t ${COMMIT_LINTER_CONTAINER_URL} "${CURDIR}/dev-dependencies"
|
-t ${DEV_CONTAINER_URL} "${CURDIR}/dev-dependencies"
|
||||||
|
|
||||||
.phony: lint-commits
|
.phony: lint-commits
|
||||||
lint-commits: build-commit-linter-container-image ## Lint commits
|
lint-commits: build-dev-container-image ## Lint commits
|
||||||
docker run \
|
docker run \
|
||||||
-v "$(CURDIR):/source-repository" \
|
-v "$(CURDIR):/source-repository" \
|
||||||
${COMMIT_LINTER_CONTAINER_URL} \
|
${DEV_CONTAINER_URL} \
|
||||||
|
commitlint \
|
||||||
--config .github/linters/commitlint.config.js \
|
--config .github/linters/commitlint.config.js \
|
||||||
--cwd /source-repository \
|
--cwd /source-repository \
|
||||||
--from ${FROM_INTERVAL_COMMITLINT} \
|
--from ${FROM_INTERVAL_COMMITLINT} \
|
||||||
--to ${TO_INTERVAL_COMMITLINT} \
|
--to ${TO_INTERVAL_COMMITLINT} \
|
||||||
--verbose
|
--verbose
|
||||||
|
|
||||||
|
.phony: release-please-dry-run
|
||||||
|
release-please-dry-run: build-dev-container-image check-github-token ## Run release-please in dry-run mode to preview the release pull request
|
||||||
|
@echo "Running release-please against branch: ${RELEASE_PLEASE_TARGET_BRANCH}"; \
|
||||||
|
docker run \
|
||||||
|
-v "$(CURDIR):/source-repository" \
|
||||||
|
${DEV_CONTAINER_URL} \
|
||||||
|
release-please \
|
||||||
|
release-pr \
|
||||||
|
--config-file .github/release-please/release-please-config.json \
|
||||||
|
--dry-run \
|
||||||
|
--manifest-file .github/release-please/.release-please-manifest.json \
|
||||||
|
--repo-url super-linter/super-linter \
|
||||||
|
--target-branch ${RELEASE_PLEASE_TARGET_BRANCH} \
|
||||||
|
--token "$(shell cat "${GITHUB_TOKEN_PATH}")" \
|
||||||
|
--trace \
|
||||||
|
|
|
@ -81,8 +81,6 @@ More in-depth [tutorial](https://www.youtube.com/watch?v=EDAmFKO4Zt0&t=118s) ava
|
||||||
|
|
||||||
To run super-linter as a GitHub Action, you do the following:
|
To run super-linter as a GitHub Action, you do the following:
|
||||||
|
|
||||||
<!-- x-release-please-start-major -->
|
|
||||||
|
|
||||||
1. Create a new [GitHub Actions workflow](https://docs.github.com/en/actions/using-workflows/about-workflows#about-workflows) in your repository with the following content:
|
1. Create a new [GitHub Actions workflow](https://docs.github.com/en/actions/using-workflows/about-workflows#about-workflows) in your repository with the following content:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
|
@ -109,7 +107,7 @@ To run super-linter as a GitHub Action, you do the following:
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Super-linter
|
- name: Super-linter
|
||||||
uses: super-linter/super-linter@v5
|
uses: super-linter/super-linter@v5.7.2 # x-release-please-version
|
||||||
env:
|
env:
|
||||||
DEFAULT_BRANCH: main
|
DEFAULT_BRANCH: main
|
||||||
# To report GitHub Actions status checks
|
# To report GitHub Actions status checks
|
||||||
|
@ -121,8 +119,6 @@ To run super-linter as a GitHub Action, you do the following:
|
||||||
1. Push the new commit to the remote repository.
|
1. Push the new commit to the remote repository.
|
||||||
1. Create a new pull request to observe the results.
|
1. Create a new pull request to observe the results.
|
||||||
|
|
||||||
<!-- x-release-please-end -->
|
|
||||||
|
|
||||||
## Add Super-Linter badge in your repository README
|
## Add Super-Linter badge in your repository README
|
||||||
|
|
||||||
You can show Super-Linter status with a badge in your repository README:
|
You can show Super-Linter status with a badge in your repository README:
|
||||||
|
|
|
@ -4,9 +4,7 @@ author: 'GitHub'
|
||||||
description: 'It is a simple combination of various linters, written in bash, to help validate your source code.'
|
description: 'It is a simple combination of various linters, written in bash, to help validate your source code.'
|
||||||
runs:
|
runs:
|
||||||
using: 'docker'
|
using: 'docker'
|
||||||
# x-release-please-start-major
|
image: 'docker://ghcr.io/super-linter/super-linter:v5.7.2' # x-release-please-version
|
||||||
image: 'docker://ghcr.io/super-linter/super-linter:v5'
|
|
||||||
# x-release-please-end
|
|
||||||
branding:
|
branding:
|
||||||
icon: 'check-square'
|
icon: 'check-square'
|
||||||
color: 'white'
|
color: 'white'
|
||||||
|
|
|
@ -11,10 +11,13 @@ WORKDIR /app
|
||||||
|
|
||||||
COPY package.json ./
|
COPY package.json ./
|
||||||
|
|
||||||
RUN jq '.dependencies | to_entries[] | select(.key | startswith("@commitlint/")) | .key + "@" + .value' package.json > commitlint-packages.txt \
|
ENV NPM_PACKAGES_FILE_PATH="npm-packages.txt"
|
||||||
&& xargs npm install -g < commitlint-packages.txt \
|
|
||||||
&& rm package.json commitlint-packages.txt \
|
|
||||||
&& commitlint --version \
|
|
||||||
&& git config --global --add safe.directory /source-repository
|
|
||||||
|
|
||||||
ENTRYPOINT [ "commitlint" ]
|
RUN jq '.dependencies | to_entries[] | select(.key | startswith("@commitlint/")) | .key + "@" + .value' package.json >> "${NPM_PACKAGES_FILE_PATH}" \
|
||||||
|
&& jq '.dependencies | to_entries[] | select(.key | startswith("release-please")) | .key + "@" + .value' package.json >> "${NPM_PACKAGES_FILE_PATH}" \
|
||||||
|
&& xargs npm install -g < "${NPM_PACKAGES_FILE_PATH}" \
|
||||||
|
&& rm package.json "${NPM_PACKAGES_FILE_PATH}"
|
||||||
|
|
||||||
|
RUN commitlint --version \
|
||||||
|
&& release-please --version \
|
||||||
|
&& git config --global --add safe.directory /source-repository
|
||||||
|
|
1106
dev-dependencies/package-lock.json
generated
1106
dev-dependencies/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -4,7 +4,8 @@
|
||||||
"version": "0.0.1-local",
|
"version": "0.0.1-local",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@commitlint/cli": "^18.4.3",
|
"@commitlint/cli": "^18.4.3",
|
||||||
"@commitlint/config-conventional": "^18.4.3"
|
"@commitlint/config-conventional": "^18.4.3",
|
||||||
|
"release-please": "^16.5.1"
|
||||||
},
|
},
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,20 @@ The Process to create a super-linter release is as follows:
|
||||||
|
|
||||||
1. Merge the release pull request.
|
1. Merge the release pull request.
|
||||||
|
|
||||||
|
## Preview the release pull request
|
||||||
|
|
||||||
|
In order to have a preview of the next release before merging a pull
|
||||||
|
request that updates the configuration of the tooling that we use to create
|
||||||
|
releases, do the following:
|
||||||
|
|
||||||
|
1. Run:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
make release-please-dry-run
|
||||||
|
```
|
||||||
|
|
||||||
|
This command also runs as part of the [CI process](../.github/workflows/ci.yml).
|
||||||
|
|
||||||
## Release workflows
|
## Release workflows
|
||||||
|
|
||||||
Every push to the default branch triggers GitHub Actions workflows that:
|
Every push to the default branch triggers GitHub Actions workflows that:
|
||||||
|
@ -13,4 +27,16 @@ Every push to the default branch triggers GitHub Actions workflows that:
|
||||||
- `super-linter/super-linter:latest`
|
- `super-linter/super-linter:latest`
|
||||||
- `super-linter/super-linter:slim-latest`
|
- `super-linter/super-linter:slim-latest`
|
||||||
|
|
||||||
- Update to the release pull request.
|
- Update the next release pull request.
|
||||||
|
|
||||||
|
## Release automation tooling
|
||||||
|
|
||||||
|
In order to automate releases, we use
|
||||||
|
[release-please](https://github.com/googleapis/release-please).
|
||||||
|
|
||||||
|
We configure release-please using two files:
|
||||||
|
|
||||||
|
- [release-please configuration file](../.github/release-please/release-please-config.json):
|
||||||
|
contains release-please configuration.
|
||||||
|
- [release-please manifest file](../.github/release-please/.release-please-manifest.json):
|
||||||
|
contains information about the current release.
|
||||||
|
|
|
@ -4,9 +4,7 @@ author: 'GitHub'
|
||||||
description: 'It is a simple combination of various linters, written in bash, to help validate your source code.'
|
description: 'It is a simple combination of various linters, written in bash, to help validate your source code.'
|
||||||
runs:
|
runs:
|
||||||
using: 'docker'
|
using: 'docker'
|
||||||
# x-release-please-start-major
|
image: 'docker://ghcr.io/super-linter/super-linter:slim-v5.7.2' # x-release-please-version
|
||||||
image: 'docker://ghcr.io/super-linter/super-linter:slim-v5'
|
|
||||||
# x-release-please-end
|
|
||||||
branding:
|
branding:
|
||||||
icon: 'check-square'
|
icon: 'check-square'
|
||||||
color: 'white'
|
color: 'white'
|
||||||
|
|
1
version.txt
Normal file
1
version.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
5.7.2
|
Loading…
Reference in a new issue