summaryrefslogtreecommitdiffstats
path: root/.github
diff options
context:
space:
mode:
Diffstat (limited to '.github')
-rwxr-xr-x.github/scripts/prepare-release-base.sh10
-rw-r--r--.github/workflows/build.yml19
-rw-r--r--.github/workflows/docker.yml24
-rw-r--r--.github/workflows/release.yml10
4 files changed, 51 insertions, 12 deletions
diff --git a/.github/scripts/prepare-release-base.sh b/.github/scripts/prepare-release-base.sh
index cb6be8e7c..838c4e86b 100755
--- a/.github/scripts/prepare-release-base.sh
+++ b/.github/scripts/prepare-release-base.sh
@@ -121,14 +121,13 @@ elif [ "${EVENT_TYPE}" = 'patch' ] && [ "${EVENT_VERSION}" != "nightly" ]; then
check_version_format || exit 1
check_for_existing_tag || exit 1
branch_name="$(echo "${EVENT_VERSION}" | cut -f 1-2 -d '.')"
- if [ -z "$(git branch --list "${branch_name}")" ]; then
+ if ! git checkout "${branch_name}"; then
echo "::error::Could not find a branch for the ${branch_name}.x release series."
exit 1
fi
- git checkout "${branch_name}"
minor_matches || exit 1
major_matches || exit 1
- check_newer_patch_number || exit 1
+ check_newer_patch_version || exit 1
echo "${EVENT_VERSION}" > packaging/version || exit 1
echo "::set-output name=run::true"
echo "::set-output name=message::Patch release ${EVENT_VERSION}."
@@ -148,14 +147,13 @@ elif [ "${EVENT_TYPE}" = 'minor' ] && [ "${EVENT_VERSION}" != "nightly" ]; then
echo "::error::A branch named ${branch_name} already exists in the repository."
exit 1
fi
- git branch "${branch_name}"
- git checkout "${branch_name}"
echo "${EVENT_VERSION}" > packaging/version || exit 1
echo "::set-output name=run::true"
echo "::set-output name=message::Minor release ${EVENT_VERSION}."
echo "::set-output name=ref::${EVENT_VERSION}"
echo "::set-output name=type::release"
- echo "::set-output name=branch::${branch_name}"
+ echo "::set-output name=branch::master"
+ echo "::set-output name=new-branch:${branch_name}"
echo "::set-output name=version::$(tr -d 'v' < packaging/version)"
elif [ "${EVENT_TYPE}" = 'major' ] && [ "${EVENT_VERSION}" != "nightly" ]; then
echo "::notice::Preparing a major release build."
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index caa49e290..a50f9df5a 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -654,6 +654,22 @@ jobs:
&& github.event_name != 'pull_request'
}}
+ normalize-tag: # Fix the release tag if needed
+ name: Normalize Release Tag
+ runs-on: ubuntu-latest
+ if: github.event_name == 'workflow_dispatch' && github.event.inputs.type == 'release'
+ outputs:
+ tag: ${{ steps.tag.outputs.tag }}
+ steps:
+ - name: Normalize Tag
+ id: tag
+ run: |
+ if echo ${{ github.event.inputs.version }} | grep -qE '^[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+$'; then
+ echo "::set-output name=tag::v${{ github.event.inputs.version }}"
+ else
+ echo "::set-output name=tag::${{ github.event.inputs.version }}"
+ fi
+
upload-release: # Create the draft release and upload the build artifacts.
name: Create Release Draft
runs-on: ubuntu-latest
@@ -663,6 +679,7 @@ jobs:
- source-build
- artifact-verification-dist
- artifact-verification-static
+ - normalize-tag
steps:
- name: Checkout
id: checkout
@@ -681,7 +698,7 @@ jobs:
artifactErrorsFailBuild: true
artifacts: 'final-artifacts/sha256sums.txt,final-artifacts/netdata-*.tar.gz,final-artifacts/netdata-*.gz.run'
draft: true
- tag: ${{ github.event.inputs.version }}
+ tag: ${{ needs.normalize-tag.outputs.tag }}
token: ${{ secrets.NETDATABOT_GITHUB_TOKEN }}
- name: Failure Notification
uses: rtCamp/action-slack-notify@v2
diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml
index 5a45b0f98..10d7093ad 100644
--- a/.github/workflows/docker.yml
+++ b/.github/workflows/docker.yml
@@ -116,10 +116,28 @@ jobs:
&& startsWith(github.ref, 'refs/heads/master')
}}
+ normalize-tag: # Fix the release tag if needed
+ name: Normalize Release Tag
+ runs-on: ubuntu-latest
+ if: github.event_name == 'workflow_dispatch'
+ outputs:
+ tag: ${{ steps.tag.outputs.tag }}
+ steps:
+ - name: Normalize Tag
+ id: tag
+ run: |
+ if echo ${{ github.event.inputs.version }} | grep -qE '^[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+$'; then
+ echo "::set-output name=tag::v${{ github.event.inputs.version }}"
+ else
+ echo "::set-output name=tag::${{ github.event.inputs.version }}"
+ fi
+
docker-publish:
if: github.event_name == 'workflow_dispatch'
name: Docker Build and Publish
- needs: docker-test
+ needs:
+ - docker-test
+ - normalize-tag
runs-on: ubuntu-latest
steps:
- name: Checkout
@@ -131,7 +149,7 @@ jobs:
id: release-tags
if: github.event.inputs.version != 'nightly'
run: |
- echo "tags=netdata/netdata:latest,netdata/netdata:stable,$(.github/scripts/gen-docker-tags.py ${{ github.event.inputs.version }})" \
+ echo "tags=netdata/netdata:latest,netdata/netdata:stable,$(.github/scripts/gen-docker-tags.py ${{ needs.normalize-tag.outputs.tag }})" \
>> "${GITHUB_ENV}"
- name: Determine which tags to use
id: nightly-tags
@@ -195,4 +213,4 @@ jobs:
repo: netdata/helmchart
workflow: Agent Version PR
ref: refs/heads/master
- inputs: '{"agent_version": "${{ github.event.inputs.version }}"}'
+ inputs: '{"agent_version": "${{ needs.normalize-tag.outputs.tag }}"}'
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 248e45e07..ae28c0019 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -80,9 +80,15 @@ jobs:
git add packaging/version CHANGELOG.md
git commit -m "[ci skip] ${{ steps.target.outputs.message }}"
if [ "${{ steps.target.outputs.type }}" != "nightly" ]; then
- git tag ${{ github.event.inputs.version }}
+ git tag -a "${{ github.event.inputs.version }}" -m "${{ steps.target.outputs.message }}"
+ fi
+ if [ -n "${{ steps.target.outputs.new-branch }}" ]; then
+ git branch "${{ steps.target.outputs.new-branch }}"
+ fi
+ git push --tags origin "${{ steps.target.outputs.branch }}"
+ if [ -n "${{ steps.target.outputs.new-branch }}" ]; then
+ git push origin "${{ steps.target.outputs.new-branch }}"
fi
- git push --follow-tags origin ${{ steps.target.outputs.branch }}
- name: Failure Notification
uses: rtCamp/action-slack-notify@v2
env: