diff options
Diffstat (limited to '.github/workflows')
-rw-r--r-- | .github/workflows/build.yml | 19 | ||||
-rw-r--r-- | .github/workflows/docker.yml | 24 | ||||
-rw-r--r-- | .github/workflows/release.yml | 10 |
3 files changed, 47 insertions, 6 deletions
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: |