mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-12 17:04:57 +00:00
Create a git tag for every release (#10811)
This commit is contained in:
parent
69f92bcc61
commit
068bcc89d3
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`);
|
||||||
|
}
|
||||||
|
};
|
18
.github/workflows/release.yml
vendored
18
.github/workflows/release.yml
vendored
@ -100,6 +100,8 @@ jobs:
|
|||||||
|
|
||||||
release-npm:
|
release-npm:
|
||||||
needs: [setup]
|
needs: [setup]
|
||||||
|
outputs:
|
||||||
|
release_version: ${{ steps.set-version.outputs.release_version }}
|
||||||
timeout-minutes: 30
|
timeout-minutes: 30
|
||||||
if: github.event.pull_request.merged == true || github.ref_name == 'master' || github.ref_name == 'master-patch-*'
|
if: github.event.pull_request.merged == true || github.ref_name == 'master' || github.ref_name == 'master-patch-*'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@ -121,6 +123,7 @@ jobs:
|
|||||||
dry-run-flag: ${{ inputs.dry-run-flag }}
|
dry-run-flag: ${{ inputs.dry-run-flag }}
|
||||||
- uses: ./.github/actions/download-node-modules-and-artifacts
|
- uses: ./.github/actions/download-node-modules-and-artifacts
|
||||||
- name: Set libraries versions
|
- name: Set libraries versions
|
||||||
|
id: set-version
|
||||||
run: |
|
run: |
|
||||||
set -u;
|
set -u;
|
||||||
./scripts/github/build/bumpversion.sh
|
./scripts/github/build/bumpversion.sh
|
||||||
@ -154,6 +157,21 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_REGISTRY_TOKEN }}
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_REGISTRY_TOKEN }}
|
||||||
|
|
||||||
|
create-git-tag:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [setup, release-npm]
|
||||||
|
name: Create github tag
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||||
|
with:
|
||||||
|
fetch-depth: 1
|
||||||
|
- uses: './.github/actions/create-git-tag'
|
||||||
|
with:
|
||||||
|
tagName: ${{ needs.release-npm.outputs.release_version }}
|
||||||
|
|
||||||
propagate:
|
propagate:
|
||||||
needs: [release-npm]
|
needs: [release-npm]
|
||||||
if: ${{ contains(toJson(github.event.pull_request.labels.*.name), 'hxp-upstream') }}
|
if: ${{ contains(toJson(github.event.pull_request.labels.*.name), 'hxp-upstream') }}
|
||||||
|
@ -49,6 +49,8 @@ get_next_version() {
|
|||||||
VERSION=`get_next_version $DIR/..`
|
VERSION=`get_next_version $DIR/..`
|
||||||
JS_API_VERSION=`get_next_version $DIR/../lib/js-api`
|
JS_API_VERSION=`get_next_version $DIR/../lib/js-api`
|
||||||
|
|
||||||
|
echo RELEASE_VERSION=$VERSION >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
echo "====== New libs version: $VERSION ====="
|
echo "====== New libs version: $VERSION ====="
|
||||||
echo "====== New js-api version: $JS_API_VERSION ====="
|
echo "====== New js-api version: $JS_API_VERSION ====="
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user