Skip to content

Commit

Permalink
- Improved when Tag is created. (#83)
Browse files Browse the repository at this point in the history
- Fixed camelCase for input parameter.
  • Loading branch information
miroslavpojer authored Oct 9, 2024
1 parent 377334a commit fc41801
Showing 1 changed file with 27 additions and 27 deletions.
54 changes: 27 additions & 27 deletions .github/workflows/release_draft.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ name: Release - create draft release
on:
workflow_dispatch:
inputs:
tagName:
tag-name:
description: 'Name of git tag to be created, and then draft release created. Syntax: "v[0-9]+.[0-9]+.[0-9]+".'
required: true

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

- name: Check tag's correct version increment
uses: actions/github-script@v7
Expand Down Expand Up @@ -73,26 +73,7 @@ jobs:
return;
}
tag-name: ${{ github.event.inputs.tagName }}

- name: Create and push tag
uses: actions/github-script@v7
with:
script: |
const tag = core.getInput('tag-name')
const ref = `refs/tags/${tag}`;
const sha = context.sha; // The SHA of the commit to tag
await github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: ref,
sha: sha
});

console.log(`Tag created: ${tag}`);
github-token: ${{ secrets.GITHUB_TOKEN }}
tag-name: ${{ github.event.inputs.tagName }}
tag-name: ${{ github.event.inputs.tag-name }}

release:
needs: tag
Expand All @@ -101,7 +82,7 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: refs/tags/${{ github.event.inputs.tagName }}
ref: refs/tags/${{ github.event.inputs.tag-name }}

- uses: actions/[email protected]
with:
Expand All @@ -113,7 +94,7 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag-name: ${{ github.event.inputs.tagName }}
tag-name: ${{ github.event.inputs.tag-name }}
chapters: |
[
{"title": "Breaking Changes 💥", "label": "breaking-change"},
Expand All @@ -123,13 +104,32 @@ jobs:
]
warnings: true

- name: Create and Push Tag
uses: actions/github-script@v7
with:
script: |
const tag = core.getInput('tag-name')
const ref = `refs/tags/${tag}`;
const sha = context.sha; // The SHA of the commit to tag
await github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: ref,
sha: sha
});
console.log(`Tag created: ${tag}`);
github-token: ${{ secrets.GITHUB_TOKEN }}
tag-name: ${{ github.event.inputs.tag-name }}

- name: Create draft release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
name: ${{ github.event.inputs.tagName }}
body: ${{ steps.release_notes_generator.outputs.releaseNotes }}
tag_name: ${{ github.event.inputs.tagName }}
name: ${{ github.event.inputs.tag-name }}
body: ${{ steps.release_notes_generator.outputs.release-notes }}
tag_name: ${{ github.event.inputs.tag-name }}
draft: true
prerelease: false

0 comments on commit fc41801

Please sign in to comment.