Skip to content

Commit 33aa95a

Browse files
authored
Do not use v prefix in prepare release workflow (#540)
1 parent fdfc6ae commit 33aa95a

File tree

3 files changed

+18
-18
lines changed

3 files changed

+18
-18
lines changed

.github/workflows/prepare_release.yml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ env:
77
on:
88
workflow_dispatch:
99
inputs:
10-
tag:
11-
description: New version tag
10+
version:
11+
description: New version number (e.g. '1.2.3' without the 'v' prefix)
1212
required: true
1313

1414
jobs:
@@ -37,30 +37,30 @@ jobs:
3737
with:
3838
node-version: 14
3939

40-
- name: Bump Gem version
40+
- name: Bump version
4141
run: |
42-
git switch -c "release/${RELEASE_TAG}"
43-
npm version --allow-same-version --no-git-tag-version "${RELEASE_TAG#v}"
44-
git commit -a -m "Bump version to ${RELEASE_TAG}"
45-
git push -f --set-upstream origin "release/${RELEASE_TAG}"
42+
git switch -c "release/${RELEASE_VERSION}"
43+
npm version --allow-same-version --no-git-tag-version "${RELEASE_VERSION}"
44+
git commit -a -m "Bump version to ${RELEASE_VERSION}"
45+
git push -f --set-upstream origin "release/${RELEASE_VERSION}"
4646
env:
47-
RELEASE_TAG: ${{ github.event.inputs.tag }}
47+
RELEASE_VERSION: ${{ github.event.inputs.version }}
4848

4949
- name: Create PR
5050
uses: actions/github-script@v5
5151
env:
52-
RELEASE_TAG: ${{ github.event.inputs.tag }}
52+
RELEASE_VERSION: ${{ github.event.inputs.version }}
5353
BASE: ${{ github.event.ref }}
5454
with:
5555
github-token: ${{ steps.get_token.outputs.token }}
5656
script: |
5757
const { data: notes } = await github.rest.repos.generateReleaseNotes({
5858
owner: context.repo.owner,
5959
repo: context.repo.repo,
60-
tag_name: process.env.RELEASE_TAG,
60+
tag_name: `v${process.env.RELEASE_VERSION}`,
6161
});
6262
const today = new Date().toJSON().slice(0, 10);
63-
const header = [`# CHANGELOG\n\n## ${process.env.RELEASE_TAG.replace(/^v/, '')} / ${today}\n`];
63+
const header = [`# CHANGELOG\n\n## ${process.env.RELEASE_VERSION} / ${today}\n`];
6464
const changes = header.concat(notes.body.split("\n").slice(3));
6565
const { data: content } = await github.rest.repos.getContent({
6666
owner: context.repo.owner,
@@ -74,23 +74,23 @@ jobs:
7474
const { data: head } = await github.rest.git.getRef({
7575
owner: context.repo.owner,
7676
repo: context.repo.repo,
77-
ref: `heads/release/${process.env.RELEASE_TAG}`,
77+
ref: `heads/release/${process.env.RELEASE_VERSION}`,
7878
});
7979
const { data: commit } = await github.rest.repos.createOrUpdateFileContents({
8080
owner: context.repo.owner,
8181
repo: context.repo.repo,
8282
message: "Update CHANGELOG",
8383
content: Buffer.from(newContent).toString("base64"),
8484
path: "CHANGELOG.md",
85-
branch: `release/${process.env.RELEASE_TAG}`,
85+
branch: `release/${process.env.RELEASE_VERSION}`,
8686
sha: content.sha,
8787
});
8888
const { data: pr } = await github.rest.pulls.create({
8989
owner: context.repo.owner,
9090
repo: context.repo.repo,
91-
head: `release/${process.env.RELEASE_TAG}`,
91+
head: `release/${process.env.RELEASE_VERSION}`,
9292
base: process.env.BASE,
93-
title: `Release ${process.env.RELEASE_TAG}`,
93+
title: `Release ${process.env.RELEASE_VERSION}`,
9494
body: "Update CHANGELOG",
9595
});
9696
await github.rest.issues.addLabels({

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
with:
3131
github-token: ${{ steps.get_token.outputs.token }}
3232
script: |
33-
const tagName = process.env.RELEASE_BRANCH.split("/")[1];
33+
const tagName = `v${process.env.RELEASE_BRANCH.split("/")[1]}`;
3434
await github.rest.git.createRef({
3535
owner: context.repo.owner,
3636
repo: context.repo.repo,

RELEASING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ The release process is controlled and run by GitHub Actions.
2323
### Update Changelog
2424

2525
1. Open [prepare release](https://github.com/DataDog/datadog-api-client-typescript/actions/workflows/prepare_release.yml) and click on `Run workflow` dropdown.
26-
1. Enter new version identifier in the `New version tag` input box (e.g. `v1.0.0-beta.9`).
26+
1. Enter new version identifier in the `New version number` input box (e.g. `1.0.0-beta.10`).
2727
1. Trigger the action by clicking on `Run workflow` button.
2828

2929
### Review
3030

31-
1. Review the generated pull-request for `release/<New version tag>` branch.
31+
1. Review the generated pull-request for `release/<New version number>` branch.
3232
1. If everything is fine, merge the pull-request.
3333
1. Check that the [release](https://github.com/DataDog/datadog-api-client-typescript/actions/workflows/release.yml) action created new release on GitHub.
3434

0 commit comments

Comments
 (0)