patch(cb2-9595): Update EU Vehicle Category for PSV and HGV (#133) #98
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
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 ✔️`) |