-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add release drafter workflows, from ssb-datadoc-models
- Loading branch information
Showing
5 changed files
with
307 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
--- | ||
# Labels names are important as they are used by Release Drafter to decide | ||
# regarding where to record them in changelog or if to skip them. | ||
# | ||
# The repository labels will be automatically configured using this file and | ||
# the GitHub Action https://github.com/marketplace/actions/github-labeler. | ||
- name: breaking | ||
description: Breaking Changes | ||
color: bfd4f2 | ||
- name: bug | ||
description: Something isn't working | ||
color: d73a4a | ||
- name: build | ||
description: Build System and Dependencies | ||
color: bfdadc | ||
- name: ci | ||
description: Continuous Integration | ||
color: 4a97d6 | ||
- name: dependencies | ||
description: Pull requests that update a dependency file | ||
color: 0366d6 | ||
- name: documentation | ||
description: Improvements or additions to documentation | ||
color: 0075ca | ||
- name: duplicate | ||
description: This issue or pull request already exists | ||
color: cfd3d7 | ||
- name: enhancement | ||
description: New feature or request | ||
color: a2eeef | ||
- name: github_actions | ||
description: Pull requests that update GitHub Actions code | ||
color: "000000" | ||
- name: help wanted | ||
description: Extra attention is needed | ||
color: 008672 | ||
- name: invalid | ||
description: This doesn't seem right | ||
color: e4e669 | ||
- name: performance | ||
description: Performance | ||
color: "016175" | ||
- name: question | ||
description: Further information is requested | ||
color: d876e3 | ||
- name: refactoring | ||
description: Refactoring | ||
color: ef67c4 | ||
- name: removal | ||
description: Removals and Deprecations | ||
color: 9ae7ea | ||
- name: testing | ||
description: Testing | ||
color: b1fc6f | ||
- name: wontfix | ||
description: This will not be worked on | ||
color: ffffff | ||
- name: 'json-schema' | ||
description: Updates to the source models | ||
color: c120e5 | ||
- name: 'python' | ||
description: Updates to the generated Python project | ||
color: 2b67c6 | ||
- name: 'java' | ||
description: Updates to the generated Java project | ||
color: 7057ff |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
name-template: 'java-v$RESOLVED_VERSION' | ||
tag-template: 'java-v$RESOLVED_VERSION' | ||
tag-prefix: 'java-v' | ||
|
||
categories: | ||
- title: ":notebook: Model" | ||
label: "json-schema" | ||
- title: ":coffee: Java" | ||
label: "java" | ||
- title: ":boom: Breaking Changes" | ||
label: "breaking" | ||
- title: ":rocket: Features" | ||
label: "enhancement" | ||
- title: ":fire: Removals and Deprecations" | ||
label: "removal" | ||
- title: ":beetle: Fixes" | ||
label: "bug" | ||
- title: ":racehorse: Performance" | ||
label: "performance" | ||
- title: ":rotating_light: Testing" | ||
label: "testing" | ||
- title: ":construction_worker: Continuous Integration" | ||
label: "ci" | ||
- title: ":books: Documentation" | ||
label: "documentation" | ||
- title: ":hammer: Refactoring" | ||
label: "refactoring" | ||
- title: ":lipstick: Style" | ||
label: "style" | ||
- title: ":package: Dependencies" | ||
labels: | ||
- "dependencies" | ||
- "build" | ||
|
||
autolabeler: | ||
- label: 'documentation' | ||
files: | ||
- 'README.md' | ||
- 'generated/java/datadoc-model/README.md' | ||
- 'generated/python/datadoc_model/README.md' | ||
- label: 'bug' | ||
branch: | ||
- '/fix\/.+/' | ||
title: | ||
- '/fix/i' | ||
- label: 'enhancement' | ||
branch: | ||
- '/feat\/.+/' | ||
body: | ||
- '/JIRA-[0-9]{1,4}/' | ||
- label: 'refactoring' | ||
branch: | ||
- '/refactor\/.+/' | ||
title: | ||
- '/^refactor/i' | ||
- label: 'testing' | ||
branch: | ||
- '/test\/.+/' | ||
- label: 'breaking' | ||
title: | ||
- '/breaking change/i' | ||
- label: 'ci' | ||
files: | ||
- '.github/*' | ||
- label: 'json-schema' | ||
files: | ||
- 'src/*' | ||
- label: 'java' | ||
files: | ||
- 'generated/java/*' | ||
|
||
template: | | ||
## Changes | ||
$CHANGES | ||
version-resolver: | ||
major: | ||
labels: | ||
- 'major' | ||
minor: | ||
labels: | ||
- 'minor' | ||
patch: | ||
labels: | ||
- 'patch' | ||
default: patch |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: Labeler | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
labeler: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out the repository | ||
uses: actions/checkout@v3 | ||
|
||
# Reads labels from .github/labels.yml | ||
- name: Run Labeler | ||
uses: crazy-max/ghaction-github-labeler@v4 | ||
with: | ||
skip-delete: true |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Release Drafter | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
# pull_request event is required only for autolabeler | ||
pull_request: | ||
types: | ||
- opened | ||
- reopened | ||
- synchronize | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
update_release_draft: | ||
permissions: | ||
# write permission is required to create a GitHub release | ||
contents: write | ||
# write permission is required for autolabeler | ||
# otherwise, read permission is required at least | ||
pull-requests: write | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: release-drafter/release-drafter@v5 | ||
name: Generate Java Release Notes | ||
with: | ||
config-name: release-drafter-java.yml | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
name: Release Java | ||
|
||
on: | ||
push: | ||
branches: | ||
- release-java* | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
id-token: write | ||
packages: write | ||
|
||
steps: | ||
- uses: actions/create-github-app-token@v1 | ||
id: app-token | ||
with: | ||
app-id: ${{ secrets.DAPLA_BOT_APP_ID }} | ||
private-key: ${{ secrets.DAPLA_BOT_PRIVATE_KEY }} | ||
|
||
- uses: actions/checkout@v3 | ||
with: | ||
token: ${{ steps.app-token.outputs.token }} | ||
ref: refs/heads/main | ||
|
||
- name: Set up JDK 21 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: 21 | ||
distribution: zulu | ||
server-id: github | ||
|
||
- name: Authenticate to Google Cloud | ||
id: auth | ||
uses: google-github-actions/auth@v1.1.1 | ||
with: | ||
workload_identity_provider: "projects/${{ secrets.GAR_PROJECT_NUMBER }}/locations/global/workloadIdentityPools/gh-actions/providers/gh-actions" | ||
service_account: "gh-actions-dapla-platform@${{ secrets.GAR_PROJECT_ID }}.iam.gserviceaccount.com" | ||
token_format: access_token | ||
|
||
- name: Cache Maven packages | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.m2 | ||
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | ||
restore-keys: ${{ runner.os }}-m2 | ||
|
||
- name: Configure Git user | ||
run: | | ||
git config user.name "dapla-bot[bot]" | ||
git config user.email "143391972+dapla-bot[bot]@users.noreply.github.com" | ||
- name: Setup Maven authentication to GitHub packages | ||
uses: s4u/maven-settings-action@v2.8.0 | ||
id: maven_settings | ||
with: | ||
servers: '[{"id": "github","configuration": {"httpHeaders": {"property": {"name": "Authorization","value": "Bearer ${{ secrets.GITHUB_TOKEN }}"}}}}]' | ||
|
||
- name: Maven release and deploy to GitHub packages | ||
id: release_jar | ||
env: | ||
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} | ||
run: | | ||
pushd generated/java/datadoc-model | ||
# Get the release version from the pom.xml before the next snapshot increment | ||
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout | sed "s/-SNAPSHOT//") | ||
echo "version=${VERSION}" >> $GITHUB_OUTPUT | ||
# Perform the release/deploy and increment the version to the next snapshot | ||
mvn --batch-mode release:prepare -Darguments="-Dmaven.deploy.skip=true -DskipTests" | ||
mvn --batch-mode release:perform | ||
TAG=$(git describe --abbrev=0 --tags) | ||
echo "tag=${TAG}" >> $GITHUB_OUTPUT | ||
- name: Create GitHub release draft | ||
uses: release-drafter/release-drafter@v5 | ||
id: create_github_release | ||
env: | ||
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} | ||
with: | ||
tag: ${{ steps.release_jar.outputs.tag }} | ||
config-name: release-drafter-java.yml | ||
|
||
- name: Upload assets to GitHub release draft | ||
env: | ||
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} | ||
run: | | ||
pushd generated/java/datadoc-model | ||
ARTIFACT_ID=$(mvn help:evaluate -Dexpression=project.artifactId -q -DforceStdout) | ||
# Get all files matching the artifact id and version (source, javadoc, etc.) | ||
ARTIFACT_GLOB=(./target/$ARTIFACT_ID-${{ steps.release_jar.outputs.version }}*.jar) | ||
for file in "${ARTIFACT_GLOB[@]}"; do | ||
echo "Uploading $file" | ||
gh release upload ${{ steps.create_github_release.outputs.tag_name }} $file | ||
done | ||
- name: Publish GitHub release | ||
uses: eregon/publish-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} | ||
with: | ||
release_id: ${{ steps.create_github_release.outputs.id }} |