Add CSM Coverage Analysis API specs #1271
Workflow file for this run
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: Release | |
permissions: | |
contents: write | |
pull-requests: write | |
env: | |
GIT_AUTHOR_EMAIL: "[email protected]" | |
GIT_AUTHOR_NAME: "ci.datadog-api-spec" | |
on: | |
pull_request: | |
types: [closed] | |
branches: | |
- master | |
jobs: | |
create_release: | |
name: Create release | |
runs-on: ubuntu-latest | |
if: github.event.pull_request.merged == true && startsWith(github.head_ref, 'release/') | |
steps: | |
- name: Get GitHub App token | |
id: get_token | |
uses: actions/create-github-app-token@v1 | |
with: | |
app-id: ${{ secrets.PIPELINE_GITHUB_APP_ID }} | |
private-key: ${{ secrets.PIPELINE_GITHUB_APP_PRIVATE_KEY }} | |
- name: Create release | |
uses: actions/github-script@v6 | |
env: | |
RELEASE_BRANCH: ${{ github.head_ref }} | |
with: | |
github-token: ${{ steps.get_token.outputs.token }} | |
script: | | |
const tagName = `v${process.env.RELEASE_BRANCH.split("/")[1]}`; | |
await github.rest.git.createRef({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
ref: `refs/tags/${tagName}`, | |
sha: context.payload.pull_request.merge_commit_sha, | |
}); | |
await github.rest.repos.createRelease({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
generate_release_notes: true, | |
tag_name: tagName, | |
}); | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
token: ${{ steps.get_token.outputs.token }} | |
- name: Setup Git | |
run: | | |
git config user.name "${GIT_AUTHOR_NAME}" | |
git config user.email "${GIT_AUTHOR_EMAIL}" | |
- name: Set up Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
cache: 'yarn' | |
- name: Bump version | |
run: | | |
git switch -c "${POST_RELEASE_BRANCH}" | |
# TODO remove beta after 1.0.0 release | |
npm version --no-git-tag-version --preid beta prerelease | |
git commit -a -m "Bump version" | |
git push -f --set-upstream origin "${POST_RELEASE_BRANCH}" | |
env: | |
POST_RELEASE_BRANCH: post-${{ github.head_ref }} | |
- name: Create PR | |
uses: actions/github-script@v6 | |
env: | |
POST_RELEASE_BRANCH: post-${{ github.head_ref }} | |
BASE: master | |
with: | |
github-token: ${{ steps.get_token.outputs.token }} | |
script: | | |
const { data: pr } = await github.rest.pulls.create({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
head: process.env.POST_RELEASE_BRANCH, | |
base: process.env.BASE, | |
title: "Post release", | |
body: "Bump to dev version", | |
}); | |
await github.rest.issues.addLabels({ | |
issue_number: pr.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
labels: ["changelog/no-changelog"], | |
}); |