Skip to content

Commit fc41801

Browse files
- Improved when Tag is created. (#83)
- Fixed camelCase for input parameter.
1 parent 377334a commit fc41801

File tree

1 file changed

+27
-27
lines changed

1 file changed

+27
-27
lines changed

.github/workflows/release_draft.yml

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ name: Release - create draft release
1818
on:
1919
workflow_dispatch:
2020
inputs:
21-
tagName:
21+
tag-name:
2222
description: 'Name of git tag to be created, and then draft release created. Syntax: "v[0-9]+.[0-9]+.[0-9]+".'
2323
required: true
2424

@@ -41,7 +41,7 @@ jobs:
4141
core.setFailed('Tag does not match the required format "v[0-9]+.[0-9]+.[0-9]+"');
4242
return;
4343
}
44-
tag-name: ${{ github.event.inputs.tagName }}
44+
tag-name: ${{ github.event.inputs.tag-name }}
4545

4646
- name: Check tag's correct version increment
4747
uses: actions/github-script@v7
@@ -73,26 +73,7 @@ jobs:
7373
return;
7474
}
7575
76-
tag-name: ${{ github.event.inputs.tagName }}
77-
78-
- name: Create and push tag
79-
uses: actions/github-script@v7
80-
with:
81-
script: |
82-
const tag = core.getInput('tag-name')
83-
const ref = `refs/tags/${tag}`;
84-
const sha = context.sha; // The SHA of the commit to tag
85-
86-
await github.rest.git.createRef({
87-
owner: context.repo.owner,
88-
repo: context.repo.repo,
89-
ref: ref,
90-
sha: sha
91-
});
92-
93-
console.log(`Tag created: ${tag}`);
94-
github-token: ${{ secrets.GITHUB_TOKEN }}
95-
tag-name: ${{ github.event.inputs.tagName }}
76+
tag-name: ${{ github.event.inputs.tag-name }}
9677

9778
release:
9879
needs: tag
@@ -101,7 +82,7 @@ jobs:
10182
- uses: actions/checkout@v4
10283
with:
10384
fetch-depth: 0
104-
ref: refs/tags/${{ github.event.inputs.tagName }}
85+
ref: refs/tags/${{ github.event.inputs.tag-name }}
10586

10687
- uses: actions/setup-python@v5.1.1
10788
with:
@@ -113,7 +94,7 @@ jobs:
11394
env:
11495
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
11596
with:
116-
tag-name: ${{ github.event.inputs.tagName }}
97+
tag-name: ${{ github.event.inputs.tag-name }}
11798
chapters: |
11899
[
119100
{"title": "Breaking Changes 💥", "label": "breaking-change"},
@@ -123,13 +104,32 @@ jobs:
123104
]
124105
warnings: true
125106

107+
- name: Create and Push Tag
108+
uses: actions/github-script@v7
109+
with:
110+
script: |
111+
const tag = core.getInput('tag-name')
112+
const ref = `refs/tags/${tag}`;
113+
const sha = context.sha; // The SHA of the commit to tag
114+
115+
await github.rest.git.createRef({
116+
owner: context.repo.owner,
117+
repo: context.repo.repo,
118+
ref: ref,
119+
sha: sha
120+
});
121+
122+
console.log(`Tag created: ${tag}`);
123+
github-token: ${{ secrets.GITHUB_TOKEN }}
124+
tag-name: ${{ github.event.inputs.tag-name }}
125+
126126
- name: Create draft release
127127
uses: softprops/action-gh-release@v1
128128
env:
129129
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
130130
with:
131-
name: ${{ github.event.inputs.tagName }}
132-
body: ${{ steps.release_notes_generator.outputs.releaseNotes }}
133-
tag_name: ${{ github.event.inputs.tagName }}
131+
name: ${{ github.event.inputs.tag-name }}
132+
body: ${{ steps.release_notes_generator.outputs.release-notes }}
133+
tag_name: ${{ github.event.inputs.tag-name }}
134134
draft: true
135135
prerelease: false

0 commit comments

Comments
 (0)