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

ci: Updating GitHub actions to use semantic versioning. #16598

Open
wants to merge 19 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
f3856c7
ci: Enabling workflows for semantic release
san-est Nov 15, 2024
c6676f9
TEMPORARY COMMIT FOR TESTING SEMANTIC RELEASE
andrewb1269hg Nov 22, 2024
d5b496a
Add .releaserc blank file
andrewb1269hg Dec 4, 2024
0b41283
Add very basic template releaserc file
andrewb1269hg Dec 6, 2024
d197832
Modify releaserc file
andrewb1269hg Dec 9, 2024
776cbb4
Change from gradle.properties to version.txt
andrewb1269hg Dec 9, 2024
733f139
Update version to -SNAPSHOT for testing purposes
andrewb1269hg Dec 11, 2024
f1c2182
Merge branch 'develop' into semantic-release-workflow-update
andrewb1269hg Dec 16, 2024
1fe8065
Update branch names, remove alpha beta ci and rc branch rules
andrewb1269hg Dec 16, 2024
02171da
Merge branch 'develop' into semantic-release-workflow-update
andrewb1269hg Dec 19, 2024
34e3520
Remove releaserc.json file
andrewb1269hg Dec 19, 2024
42b2802
Update version.txt to 99.99.99-SNAPSHOT for testing
andrewb1269hg Dec 19, 2024
42274de
Add spotless fix
andrewb1269hg Dec 19, 2024
86004cd
Use official release version instead of SNAPSHOT version
andrewb1269hg Dec 20, 2024
90528a5
Roll version of gradle build to 0.1.3
andrewb1269hg Dec 20, 2024
5d91721
Update gradle build to 0.1.4
andrewb1269hg Dec 20, 2024
73ab431
Merge branch 'develop' into semantic-release-workflow-update
andrewb1269hg Dec 21, 2024
c432403
Roll version.txt back to 0.58.0 and change branch to "main"
andrewb1269hg Dec 21, 2024
d0aee00
Merge branch 'semantic-release-workflow-update' of github.com:hashgra…
andrewb1269hg Dec 21, 2024
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
72 changes: 55 additions & 17 deletions .github/workflows/node-flow-deploy-release-artifact.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,30 +55,68 @@ jobs:
with:
egress-policy: audit

- name: Install Semantic Version Tools
- name: Checkout Code
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
with:
token: ${{ secrets.GH_ACCESS_TOKEN }}
fetch-depth: 0


- name: Install GnuPG Tools
run: |
echo "::group::Download SemVer Binary"
sudo curl -L -o /usr/local/bin/semver https://raw.githubusercontent.com/fsaintjacques/semver-tool/master/src/semver
echo "::endgroup::"
echo "::group::Change SemVer Binary Permissions"
sudo chmod -v +x /usr/local/bin/semver
echo "::endgroup::"
echo "::group::Show SemVer Binary Version Info"
semver --version
echo "::endgroup::"
if ! command -v gpg2 >/dev/null 2>&1; then
echo "::group::Updating APT Repository Indices"
sudo apt update
echo "::endgroup::"
echo "::group::Installing GnuPG Tools"
sudo apt install -y gnupg2
echo "::endgroup::"
fi

- name: Import GPG key
id: gpg_key
uses: step-security/ghaction-import-gpg@6c8fe4d0126a59d57c21f87c9ae5dd3451fa3cca # v6.1.0
with:
gpg_private_key: ${{ secrets.GPG_KEY_CONTENTS }}
passphrase: ${{ secrets.GPG_KEY_PASSPHRASE }}
git_config_global: true
git_user_signingkey: true
git_commit_gpgsign: true
git_tag_gpgsign: false

- name: Setup Node
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with:
node-version: 20

- name: Install Semantic Release
run: |
npm install -g semantic-release@21.0.7 @semantic-release/git@10.0.1 @semantic-release/exec@6.0.3 gradle-semantic-release-plugin@1.7.6
npm install -g conventional-changelog-conventionalcommits@6.1.0 @commitlint/cli@17.6.6 @commitlint/config-conventional@17.6.6
npm install -g marked-mangle@1.0.1 marked-gfm-heading-id@3.0.4 semantic-release-conventional-commits@3.0.0

- name: Calculate Next Version
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
andrewb1269hg marked this conversation as resolved.
Show resolved Hide resolved
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GIT_AUTHOR_NAME: ${{ secrets.GIT_USER_NAME }}
GIT_AUTHOR_EMAIL: ${{ secrets.GIT_USER_EMAIL }}
GIT_COMMITTER_NAME: ${{ secrets.GIT_USER_NAME }}
GIT_COMMITTER_EMAIL: ${{ secrets.GIT_USER_EMAIL }}
run: |
npx semantic-release --dry-run
ls -al
cat VERSION

- name: Extract Tag Version
id: tag
run: |
RELEASE_VERSION="$(semver get release "${{ github.ref_name }}")"
PRERELEASE_VERSION="$(semver get prerel "${{ github.ref_name }}")"

FINAL_VERSION="${RELEASE_VERSION}"
cat VERSION
RELEASE_VERSION="$(cat VERSION | tr -d '[:space:]')"
PRERELEASE_FLAG="false"
[[ -n "${PRERELEASE_VERSION}" ]] && FINAL_VERSION="${RELEASE_VERSION}-${PRERELEASE_VERSION}"
[[ -n "${PRERELEASE_VERSION}" ]] && PRERELEASE_FLAG="true"
[[ "${RELEASE_VERSION}" == *"-"* ]] && PRERELEASE_FLAG="true"

echo "version=${FINAL_VERSION}" >>"${GITHUB_OUTPUT}"
echo "version=${RELEASE_VERSION}" >>"${GITHUB_OUTPUT}"
echo "prerelease=${PRERELEASE_FLAG}" >>"${GITHUB_OUTPUT}"

release-tag:
Expand Down
40 changes: 36 additions & 4 deletions .github/workflows/node-zxc-build-release-artifact.yaml
san-est marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,36 @@ jobs:
semver --version
echo "::endgroup::"

- name: Setup Node
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with:
node-version: 20

- name: Install Semantic Release
run: |
npm install -g semantic-release@21.0.7 @semantic-release/git@10.0.1 @semantic-release/exec@6.0.3 gradle-semantic-release-plugin@1.7.6
npm install -g conventional-changelog-conventionalcommits@6.1.0 @commitlint/cli@17.6.6 @commitlint/config-conventional@17.6.6
npm install -g marked-mangle@1.0.1 marked-gfm-heading-id@3.0.4 semantic-release-conventional-commits@3.0.0

- name: Checkout Code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0

- name: Calculate Next Version
if: ${{ inputs.version-policy == 'specified' }}
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GIT_AUTHOR_NAME: ${{ secrets.GIT_USER_NAME }}
GIT_AUTHOR_EMAIL: ${{ secrets.GIT_USER_EMAIL }}
GIT_COMMITTER_NAME: ${{ secrets.GIT_USER_NAME }}
GIT_COMMITTER_EMAIL: ${{ secrets.GIT_USER_EMAIL }}
run: |
npx semantic-release --dry-run
ls -al
cat VERSION

- name: Verify Workflow Parameters
id: parameters
run: |
Expand Down Expand Up @@ -175,9 +205,6 @@ jobs:
exit 2
fi

- name: Checkout Code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Setup Java
uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4.5.0
with:
Expand All @@ -200,7 +227,12 @@ jobs:
- name: Compute Final Effective Version
id: effective-version
run: |
EFF_VERSION="$(./gradlew showVersion --quiet | tr -d '[:space:]')"
if [[ "${{ inputs.version-policy }}" == "specified" ]]; then
EFF_VERSION="${{ inputs.new-version }}"
else
EFF_VERSION="$(cat VERSION | tr -d '[:space:]')"
fi

PRERELEASE_SUFFIX="$(semver get prerel "${EFF_VERSION}")"
PRERELEASE="false"
[[ -n "${PRERELEASE_SUFFIX}" ]] && PRERELEASE="true"
Expand Down
43 changes: 43 additions & 0 deletions .releaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"plugins": [
"@semantic-release/commit-analyzer",
[
"@semantic-release/release-notes-generator",
{
"preset": "conventionalcommits"
}
],
"@semantic-release/git",
"@semantic-release/github"
],
"verifyRelease": [
[
"@semantic-release/exec",
{ "cmd": "echo ${nextRelease.version} > VERSION" }
]
],
"prepare": [
[
"@semantic-release/exec",
{ "cmd": "./gradlew versionAsSpecified --scan -PnewVersion=${nextRelease.version}" }
],
[
"@semantic-release/git",
{
"assets": [
"version.txt"
]
}
]
],
"branches":[
{
"name": "main"
},
{
"name": "release/([0-9]+).([0-9]+)",
"channel": "${name.replace(/release\\//g, '').split('.')[0]}.${name.replace(/release\\//g, '').split('.')[1]}.x",
"range": "${name.replace(/release\\//g, '').split('.')[0]}.${name.replace(/release\\//g, '').split('.')[1]}.x"
}
]
}
Loading