Ensure versioned release tags include a leading `v` in workflows. (#12695)
Austin S. Hemmelgarn committed
Apr 15, 2022 at 08:17 UTC
19fa9e355c48b4c76966abfec8fe2cf6342ee22e
2 files changed
+39
-4
.github/workflows/build.yml
+18
-1
@@ -654,6 +654,22 @@ jobs:
654
&& github.event_name != 'pull_request'
655
}}
656
657
+ normalize-tag: # Fix the release tag if needed
658
+ name: Normalize Release Tag
659
+ runs-on: ubuntu-latest
660
+ if: github.event_name == 'workflow_dispatch' && github.event.inputs.type == 'release'
661
+ outputs:
662
+ tag: ${{ steps.tag.outputs.tag }}
663
+ steps:
664
+ - name: Normalize Tag
665
+ id: tag
666
+ run: |
667
+ if echo ${{ github.event.inputs.version }} | grep -qE '^[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+$'; then
668
+ echo "::set-output name=tag::v${{ github.event.inputs.version }}"
669
+ else
670
+ echo "::set-output name=tag::${{ github.event.inputs.version }}"
671
+ fi
672
+
673
upload-release: # Create the draft release and upload the build artifacts.
674
name: Create Release Draft
675
runs-on: ubuntu-latest
@@ -663,6 +679,7 @@ jobs:
679
- source-build
680
- artifact-verification-dist
681
- artifact-verification-static
682
+ - normalize-tag
683
steps:
684
- name: Checkout
685
id: checkout
@@ -681,7 +698,7 @@ jobs:
698
artifactErrorsFailBuild: true
699
artifacts: 'final-artifacts/sha256sums.txt,final-artifacts/netdata-*.tar.gz,final-artifacts/netdata-*.gz.run'
700
draft: true
684
- tag: ${{ github.event.inputs.version }}
701
+ tag: ${{ needs.normalize-tag.outputs.tag }}
702
token: ${{ secrets.NETDATABOT_GITHUB_TOKEN }}
703
- name: Failure Notification
704
uses: rtCamp/action-slack-notify@v2
.github/workflows/docker.yml
+21
-3
@@ -116,10 +116,28 @@ jobs:
116
&& startsWith(github.ref, 'refs/heads/master')
117
}}
118
119
+ normalize-tag: # Fix the release tag if needed
120
+ name: Normalize Release Tag
121
+ runs-on: ubuntu-latest
122
+ if: github.event_name == 'workflow_dispatch'
123
+ outputs:
124
+ tag: ${{ steps.tag.outputs.tag }}
125
+ steps:
126
+ - name: Normalize Tag
127
+ id: tag
128
+ run: |
129
+ if echo ${{ github.event.inputs.version }} | grep -qE '^[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+$'; then
130
+ echo "::set-output name=tag::v${{ github.event.inputs.version }}"
131
+ else
132
+ echo "::set-output name=tag::${{ github.event.inputs.version }}"
133
+ fi
134
+
135
docker-publish:
136
if: github.event_name == 'workflow_dispatch'
137
name: Docker Build and Publish
122
- needs: docker-test
138
+ needs:
139
+ - docker-test
140
+ - normalize-tag
141
runs-on: ubuntu-latest
142
steps:
143
- name: Checkout
@@ -131,7 +149,7 @@ jobs:
149
id: release-tags
150
if: github.event.inputs.version != 'nightly'
151
run: |
134
- echo "tags=netdata/netdata:latest,netdata/netdata:stable,$(.github/scripts/gen-docker-tags.py ${{ github.event.inputs.version }})" \
152
+ echo "tags=netdata/netdata:latest,netdata/netdata:stable,$(.github/scripts/gen-docker-tags.py ${{ needs.normalize-tag.outputs.tag }})" \
153
>> "${GITHUB_ENV}"
154
- name: Determine which tags to use
155
id: nightly-tags
@@ -195,4 +213,4 @@ jobs:
213
repo: netdata/helmchart
214
workflow: Agent Version PR
215
ref: refs/heads/master
198
- inputs: '{"agent_version": "${{ github.event.inputs.version }}"}'
216
+ inputs: '{"agent_version": "${{ needs.normalize-tag.outputs.tag }}"}'