From 16afbc965cb3f78641021d5687ef221a88e56ec1 Mon Sep 17 00:00:00 2001 From: Matt Wiley <82392933+mattwiley-8451@users.noreply.github.com> Date: Wed, 14 Jun 2023 21:55:58 -0400 Subject: [PATCH 1/4] Removing new commit requirement. (#2) * Removing new commit requirement. * Updating metadata and ensuring self-hosted runner usage. * README updates. * Refactoring set output to GITHUB_OUTPUT * Correcting outputs to reflect the pre-release source tag. --- .8451/metadata.yml | 14 ++++++++++++++ .github/workflows/main.yml | 2 +- README.md | 22 ++++------------------ entrypoint.sh | 38 ++++++++++++++++++++++++++++---------- 4 files changed, 47 insertions(+), 29 deletions(-) create mode 100644 .8451/metadata.yml diff --git a/.8451/metadata.yml b/.8451/metadata.yml new file mode 100644 index 00000000..f35a737e --- /dev/null +++ b/.8451/metadata.yml @@ -0,0 +1,14 @@ +program: Science & Developer Services +profit_stream: enterprise_capabilities +value_stream: DevSecOps +product: SDS +capability: Build +component: ext-fork-github-tag-action +team: Dev Pipelines +contacts: + team: + - EC-SoftwareDeliverySystem_DL@8451.com + technical: + - EC-SoftwareDeliverySystem_DL@8451.com + product: + - EC-SoftwareDeliverySystem_DL@8451.com diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c3ca724e..ced644e6 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -5,7 +5,7 @@ on: - master jobs: build: - runs-on: ubuntu-latest + runs-on: self-hosted steps: - uses: actions/checkout@master with: diff --git a/README.md b/README.md index 0fc77652..775b9a52 100755 --- a/README.md +++ b/README.md @@ -2,13 +2,8 @@ A Github Action to automatically bump and tag master, on merge, with the latest SemVer formatted version. -[![Build Status](https://github.com/anothrNick/github-tag-action/workflows/Bump%20version/badge.svg)](https://github.com/anothrNick/github-tag-action/workflows/Bump%20version/badge.svg) -[![Stable Version](https://img.shields.io/github/v/tag/anothrNick/github-tag-action)](https://img.shields.io/github/v/tag/anothrNick/github-tag-action) -[![Latest Release](https://img.shields.io/github/v/release/anothrNick/github-tag-action?color=%233D9970)](https://img.shields.io/github/v/release/anothrNick/github-tag-action?color=%233D9970) +> **IMPORTANT:** This is a fork of [anothrNick/github-tag-action](https://github.com/anothrNick/github-tag-action), and is branched fo development from tag [1.36.0](https://github.com/anothrNick/github-tag-action/releases/tag/1.36.0) (commit hash [ce4b5ffa38e072fa7a901e417253c438fcc2ccce](https://github.com/anothrNick/github-tag-action/tree/ce4b5ffa38e072fa7a901e417253c438fcc2ccce)). -> Medium Post: [Creating A Github Action to Tag Commits](https://itnext.io/creating-a-github-action-to-tag-commits-2722f1560dec) - -[](https://itnext.io/creating-a-github-action-to-tag-commits-2722f1560dec) ### Usage @@ -20,13 +15,13 @@ on: - master jobs: build: - runs-on: ubuntu-latest + runs-on: self-hosted steps: - uses: actions/checkout@v2 with: fetch-depth: '0' - name: Bump version and push tag - uses: anothrNick/github-tag-action@1.36.0 + uses: ext-fork-github-tag-action@1.0.0 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} WITH_V: true @@ -53,6 +48,7 @@ _NOTE: set the fetch-depth for `actions/checkout@v2` to be sure you retrieve all #### Outputs - **new_tag** - The value of the newly created tag. + - **tag** - The value of the latest tag after running this action. - **part** - The part of version which was bumped. @@ -82,13 +78,3 @@ If `#none` is contained in the commit message, it will skip bumping regardless ` ### Credits [fsaintjacques/semver-tool](https://github.com/fsaintjacques/semver-tool) - -### Projects using github-tag-action - -A list of projects using github-tag-action for reference. - -- another/github-tag-action (uses itself to create tags) - -- [anothrNick/json-tree-service](https://github.com/anothrNick/json-tree-service) - - > Access JSON structure with HTTP path parameters as keys/indices to the JSON. diff --git a/entrypoint.sh b/entrypoint.sh index 49ce3be8..3a5ebeef 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -77,9 +77,13 @@ tag_commit=$(git rev-list -n 1 $tag) commit=$(git rev-parse HEAD) if [ "$tag_commit" == "$commit" ]; then - echo "No new commits since previous tag. Skipping..." - echo ::set-output name=tag::$tag - exit 0 + # + # Inform the user that the commit hash is the same as the tag, + # but do not exit. + # + # This allows users to apply multiple tags to the same commit. + # + echo "No new commits since previous tag." fi # echo log if verbose is wanted @@ -93,12 +97,20 @@ case "$log" in *#minor* ) new=$(semver -i minor $tag); part="minor";; *#patch* ) new=$(semver -i patch $tag); part="patch";; *#none* ) - echo "Default bump was set to none. Skipping..."; echo ::set-output name=new_tag::$tag; echo ::set-output name=tag::$tag; exit 0;; + echo "Default bump was set to none. Skipping..." + echo "new_tag=$tag" >> $GITHUB_OUTPUT + echo "tag=$tag" >> $GITHUB_OUTPUT + exit 0 + ;; * ) if [ "$default_semvar_bump" == "none" ]; then - echo "Default bump was set to none. Skipping..."; echo ::set-output name=new_tag::$tag; echo ::set-output name=tag::$tag; exit 0 + echo "Default bump was set to none. Skipping..." + echo "new_tag=$tag" >> $GITHUB_OUTPUT + echo "tag=$tag" >> $GITHUB_OUTPUT + exit 0 else - new=$(semver -i "${default_semvar_bump}" $tag); part=$default_semvar_bump + new=$(semver -i "${default_semvar_bump}" $tag) + part=$default_semvar_bump fi ;; esac @@ -138,17 +150,23 @@ else fi # set outputs -echo ::set-output name=new_tag::$new -echo ::set-output name=part::$part +echo "new_tag=$new" >> $GITHUB_OUTPUT +echo "part=$part" >> $GITHUB_OUTPUT + +if $pre_release +then + echo "tag=$pre_tag" >> $GITHUB_OUTPUT +else + echo "tag=$tag" >> $GITHUB_OUTPUT +fi + # use dry run to determine the next tag if $dryrun then - echo ::set-output name=tag::$tag exit 0 fi -echo ::set-output name=tag::$new # create local git tag git tag $new From 2d2c339f97400c2ad0ad8701d1e5afe4bd7376eb Mon Sep 17 00:00:00 2001 From: Matt Wiley <82392933+mattwiley-8451@users.noreply.github.com> Date: Thu, 15 Jun 2023 14:33:03 -0400 Subject: [PATCH 2/4] Updating ref used in README docs. (#3) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 775b9a52..10808364 100755 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ jobs: with: fetch-depth: '0' - name: Bump version and push tag - uses: ext-fork-github-tag-action@1.0.0 + uses: ext-fork-github-tag-action@sds-1.0.0 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} WITH_V: true From ff5983731f66c0d3d96f9c1fce6d8aca2c705074 Mon Sep 17 00:00:00 2001 From: hafezgharbiah-8451 Date: Wed, 20 Sep 2023 09:56:38 -0600 Subject: [PATCH 3/4] Update reference to head branch so that appropriate branch is picked up during PRs --- entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index 3a5ebeef..72702d37 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -28,7 +28,7 @@ echo -e "\tTAG_CONTEXT: ${tag_context}" echo -e "\tPRERELEASE_SUFFIX: ${suffix}" echo -e "\tVERBOSE: ${verbose}" -current_branch=$(git rev-parse --abbrev-ref HEAD) +current_branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}} pre_release="true" IFS=',' read -ra branch <<< "$release_branches" From e8a85c41407031f75530338a784fb95b40c22072 Mon Sep 17 00:00:00 2001 From: nickmcclorey-8451 Date: Mon, 2 Dec 2024 13:32:45 -0500 Subject: [PATCH 4/4] pull through artifactory --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 5cc5a480..404ec784 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM alpine:3.10 +FROM docker-all.artifactory.8451.cloud/alpine:3.10 LABEL "repository"="https://github.com/anothrNick/github-tag-action" LABEL "homepage"="https://github.com/anothrNick/github-tag-action" LABEL "maintainer"="Nick Sjostrom"