Skip to content

minor(cb-12996): Added test code to test types (#177) #131

minor(cb-12996): Added test code to test types (#177)

minor(cb-12996): Added test code to test types (#177) #131

name: Create Release
on:
push:
branches: ["develop"]
jobs:
test-and-generate-check:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- name: Setup version env var
run: |
echo "VERSION=v$(jq -r .version package.json)" >> "$GITHUB_ENV"
- uses: actions/github-script@v6
with:
script: |
const prIntroducingCommit = (await github.rest.repos.listPullRequestsAssociatedWithCommit({
...context.repo,
commit_sha: context.sha
})).data[0]
prIntroducingCommit && console.log("Found pull request associated with commit... ✔️")
const githubTag = await github.rest.git.createRef({
...context.repo,
sha: context.sha,
ref: `refs/tags/${process.env.VERSION}`
})
console.log(`Created new git tag ${process.env.VERSION}... ✔️`)
const releaseBody = prIntroducingCommit.body.substring(prIntroducingCommit.body.indexOf("## Changelog"),
prIntroducingCommit.body.indexOf("<!--DO NOT REMOVE COMMENT. MARKS END OF CHANGES SECTION.-->"))
await github.rest.repos.createRelease({
...context.repo,
tag_name: process.env.VERSION,
body: releaseBody
})
console.log(`Release ${process.env.VERSION} created ✔️`)