Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve create rls draft workflow #83

Merged
merged 1 commit into from
Oct 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading