Skip to content

Commit 7538f72

Browse files
authored
chore: Update create-release.yml
Attempt to support automatic release creation.
1 parent ce8ceee commit 7538f72

File tree

1 file changed

+39
-5
lines changed

1 file changed

+39
-5
lines changed

.github/workflows/create-release.yml

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,55 @@ name: Create Release
55
# Controls when the action will run. Workflow runs when manually triggered using the UI
66
# or API.
77
on:
8+
push:
9+
branches:
10+
- gh-pages
11+
tags:
12+
- v*
813
workflow_dispatch:
914
# Inputs the workflow accepts.
1015
inputs:
1116
release:
1217
description: 'Release Version'
13-
# Input has to be provided for the workflow to run
14-
required: true
18+
default: 'latest'
19+
workflow_call:
20+
outputs:
21+
release:
22+
description: "Release Version"
23+
value: ${{ jobs.get_release.outputs.release }}
1524

1625
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
1726
jobs:
27+
get_release:
28+
# The type of runner that the job will run on
29+
runs-on: ubuntu-latest
30+
env:
31+
GH_TOKEN: ${{ github.token }}
32+
33+
# Steps represent a sequence of tasks that will be executed as part of the job
34+
steps:
35+
- name: Checkout
36+
uses: actions/[email protected]
37+
with:
38+
ref: gh-pages
39+
40+
- name: Get Latest Release
41+
id: get_latest_release
42+
if: github.event.inputs.release == 'latest'
43+
run: echo "release=$(git describe --abbrev=0)" >> "$GITHUB_OUTPUT"
44+
45+
- name: Get Specified Release
46+
id: get_specified_release
47+
if: ${{ failure() }}
48+
run: echo "release=${{ github.event.inputs.release }}" >> "$GITHUB_OUTPUT"
49+
1850
create_release:
1951
# The type of runner that the job will run on
2052
runs-on: ubuntu-latest
53+
needs: get_release
2154
env:
2255
GH_TOKEN: ${{ github.token }}
56+
RELEASE: $
2357

2458
# Steps represent a sequence of tasks that will be executed as part of the job
2559
steps:
@@ -31,9 +65,9 @@ jobs:
3165
- name: Zip Release
3266
uses: TheDoctor0/[email protected]
3367
with:
34-
filename: ui-grid-${{ github.event.inputs.release }}.zip
35-
path: ./release/${{ github.event.inputs.release }}/*
68+
filename: ui-grid-$RELEASE.zip
69+
path: ./release/$RELEASE/*
3670

3771
- name: Publish Release
38-
run: gh release create v${{ github.event.inputs.release }} ./ui-grid-${{ github.event.inputs.release }}.zip
72+
run: gh release create v$RELEASE ./ui-grid-$RELEASE.zip
3973

0 commit comments

Comments
 (0)