File tree 2 files changed +36
-2
lines changed
2 files changed +36
-2
lines changed Original file line number Diff line number Diff line change @@ -49,10 +49,27 @@ jobs:
49
49
- name : test
50
50
run : pnpm run test
51
51
52
+ - name : generate api version
53
+ id : api-version
54
+ env :
55
+ HEAD_REF : ${{ github.head_ref }}
56
+ REF_NAME : ${{ github.ref_name }}
57
+ run : |
58
+ BRANCH_NAME="${HEAD_REF:-$REF_NAME}"
59
+
60
+ # replace forward slashes and special characters with hyphens
61
+ CLEAN_BRANCH=$(echo "$BRANCH_NAME" | sed 's/[^a-zA-Z0-9]/-/g')
62
+
63
+ # get short SHA (first 7 characters)
64
+ SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-7)
65
+
66
+ # combine
67
+ echo "version=$CLEAN_BRANCH-$SHORT_SHA" >> "$GITHUB_OUTPUT"
68
+
52
69
- name : deploy
53
70
if : ${{ github.event.inputs.dry-run != 'true' }}
54
71
env :
55
- API_VERSION : ${{ github.sha }}
72
+ API_VERSION : ${{ steps.api-version.outputs.version }}
56
73
uses : cloudflare/wrangler-action@6d58852c35a27e6034745c5d0bc373d739014f7f # v3.13.0
57
74
with :
58
75
apiToken : ${{ secrets.CF_API_TOKEN }}
Original file line number Diff line number Diff line change @@ -48,10 +48,27 @@ jobs:
48
48
- name : test
49
49
run : pnpm run test
50
50
51
+ - name : generate api version
52
+ id : api-version
53
+ env :
54
+ HEAD_REF : ${{ github.head_ref }}
55
+ REF_NAME : ${{ github.ref_name }}
56
+ run : |
57
+ BRANCH_NAME="${HEAD_REF:-$REF_NAME}"
58
+
59
+ # replace forward slashes and special characters with hyphens
60
+ CLEAN_BRANCH=$(echo "$BRANCH_NAME" | sed 's/[^a-zA-Z0-9]/-/g')
61
+
62
+ # get short SHA (first 7 characters)
63
+ SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-7)
64
+
65
+ # combine
66
+ echo "version=$CLEAN_BRANCH-$SHORT_SHA" >> "$GITHUB_OUTPUT"
67
+
51
68
- name : deploy
52
69
if : ${{ github.event.inputs.dry-run != 'true' }}
53
70
env :
54
- API_VERSION : ${{ github.sha }}
71
+ API_VERSION : ${{ steps.api-version.outputs.version }}
55
72
uses : cloudflare/wrangler-action@6d58852c35a27e6034745c5d0bc373d739014f7f # v3.13.0
56
73
with :
57
74
apiToken : ${{ secrets.CF_API_TOKEN }}
You can’t perform that action at this time.
0 commit comments