Skip to content

Commit d702c9f

Browse files
committed
Allow both manual and auto tag name
1 parent 69f004e commit d702c9f

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

.github/workflows/build.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ on:
77
branches:
88
- main
99

10+
env:
11+
TAG_NAME: ${{ github.ref }}
12+
1013
# Docs on sharing data between jobs (between VMs): https://help.github.com/en/actions/configuring-and-managing-workflows/persisting-workflow-data-using-artifacts#passing-data-between-jobs-in-a-workflow
1114
jobs:
1215
json_build:
@@ -22,16 +25,18 @@ jobs:
2225
- name: Run Build and Deploy Script
2326
run: python build.py
2427

25-
- name: Set current date as env variable
26-
run: echo "NOW=$(date +'%Y-%m-%d_%H-%M-%S')" >> $GITHUB_ENV
28+
# If the ref is a commit (anything not a tag), generate a tag name using the date
29+
- name: Set current date as tag name
30+
run: echo "TAG_NAME=$(date +'%Y-%m-%d_%H-%M-%S')" >> $GITHUB_ENV
31+
if: github.ref_type != 'tag'
2732

2833
# Note: need to keep *.json files for compatability with older installers
2934
# Can be removed once it is unlikely people are using the old installer
3035
- name: Release
3136
uses: softprops/action-gh-release@v1
3237
#if: startsWith(github.ref, 'refs/tags/') # only publish tagged commits
3338
with:
34-
tag_name: ${{ env.NOW }}
39+
tag_name: ${{ env.TAG_NAME }}
3540
files: |
3641
*.json
3742
*.zip

0 commit comments

Comments
 (0)