81569f3461
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
95 lines
3.9 KiB
YAML
95 lines
3.9 KiB
YAML
# Workflow used by other workflows to generate draft releases.
|
|
name: Release Drafter Reusable
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
include-changes:
|
|
description: Project to include changelog entries from in this release.
|
|
type: string
|
|
required: false
|
|
concurrency: release-drafter-action
|
|
permissions: {}
|
|
jobs:
|
|
draft:
|
|
runs-on: ubuntu-24.04
|
|
permissions:
|
|
contents: write
|
|
steps:
|
|
- name: 🧮 Checkout code
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
|
with:
|
|
ref: staging
|
|
fetch-depth: 0
|
|
persist-credentials: false
|
|
|
|
- uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5
|
|
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
|
|
with:
|
|
node-version-file: package.json
|
|
cache: "pnpm"
|
|
|
|
- name: Install Deps
|
|
run: "pnpm install --frozen-lockfile"
|
|
|
|
- uses: t3chguy/release-drafter@105e541c2c3d857f032bd522c0764694758fabad
|
|
id: draft-release
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
disable-autolabeler: true
|
|
|
|
- name: Get actions scripts
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
|
with:
|
|
repository: matrix-org/matrix-js-sdk
|
|
persist-credentials: false
|
|
path: .action-repo
|
|
sparse-checkout: |
|
|
.github/actions
|
|
scripts/release
|
|
|
|
- name: Ingest upstream changes
|
|
if: inputs.include-changes
|
|
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
RELEASE_ID: ${{ steps.draft-release.outputs.id }}
|
|
DEPENDENCY: ${{ inputs.include-changes }}
|
|
VERSION: ${{ steps.draft-release.outputs.tag_name }}
|
|
with:
|
|
retries: 3
|
|
script: |
|
|
const { RELEASE_ID: releaseId, DEPENDENCY, VERSION } = process.env;
|
|
const { owner, repo } = context.repo;
|
|
const script = require("./.action-repo/scripts/release/merge-release-notes.cjs");
|
|
|
|
let deps = [];
|
|
if (DEPENDENCY.includes("/")) {
|
|
deps.push(DEPENDENCY.replace("$VERSION", VERSION))
|
|
} else {
|
|
const fromVersion = JSON.parse((await github.request(`https://raw.githubusercontent.com/${owner}/${repo}/master/package.json`)).data).dependencies[DEPENDENCY];
|
|
const toVersion = require("./package.json").dependencies[DEPENDENCY];
|
|
|
|
if (toVersion.endsWith("#develop")) {
|
|
core.warning(`${DEPENDENCY} will be kept at ${fromVersion}`, { title: "Develop dependency found" });
|
|
} else {
|
|
deps.push([DEPENDENCY, fromVersion, toVersion]);
|
|
}
|
|
}
|
|
|
|
if (deps.length) {
|
|
const notes = await script({
|
|
github,
|
|
releaseId,
|
|
dependencies: deps,
|
|
});
|
|
|
|
await github.rest.repos.updateRelease({
|
|
owner,
|
|
repo,
|
|
release_id: releaseId,
|
|
body: notes,
|
|
tag_name: VERSION,
|
|
});
|
|
}
|