mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
Create a git tag for every release (#10811)
This commit is contained in:
23
.github/actions/create-git-tag/action.yml
vendored
Normal file
23
.github/actions/create-git-tag/action.yml
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
name: Git tag creation
|
||||
description: 'Creates a git tag in the specified repository for a given commit.'
|
||||
|
||||
inputs:
|
||||
tagName:
|
||||
description: 'The github tag to be created'
|
||||
required: true
|
||||
releaseNote:
|
||||
description: 'The github release note to be created'
|
||||
required: false
|
||||
|
||||
runs:
|
||||
using: 'composite'
|
||||
steps:
|
||||
- uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
|
||||
name: Create git tag
|
||||
env:
|
||||
TAG_NAME: ${{ inputs.tagName }}
|
||||
RELEASE_NOTE: ${{ inputs.releaseNote }}
|
||||
with:
|
||||
script: |
|
||||
const createGitTag = require('./.github/actions/create-git-tag/create-git-tag.js');
|
||||
await createGitTag({ core, github, context, tagName: process.env.TAG_NAME });
|
42
.github/actions/create-git-tag/create-git-tag.js
vendored
Normal file
42
.github/actions/create-git-tag/create-git-tag.js
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright © 2005-2023 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
module.exports = async ({ github, context, core, tagName }) => {
|
||||
const tagSHA = context.payload?.after ?? context.sha;
|
||||
|
||||
core.notice(`Creating a tag with title: ${tagName}, and SHA: ${tagSHA}`);
|
||||
|
||||
const createdTag = await github.rest.git.createTag({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
tag: tagName,
|
||||
message: 'Release note',
|
||||
object: tagSHA,
|
||||
type: 'commit'
|
||||
});
|
||||
|
||||
const createdRef = await github.rest.git.createRef({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
ref: 'refs/tags/' + tagName,
|
||||
sha: createdTag.data.sha
|
||||
});
|
||||
|
||||
if (createdRef.status === 201) {
|
||||
core.notice(`Tag ${tagName} was created successfully`);
|
||||
}
|
||||
};
|
Reference in New Issue
Block a user