@@ -15,45 +15,52 @@ jobs:
15
15
with :
16
16
fetch-depth : 0
17
17
18
+ - name : Setup Node
19
+
20
+
21
+ - name : Install release-please & simple-git
22
+ run : npm install release-please simple-git
23
+
24
+ - name : Generate Chart Version
25
+ id : version
26
+
27
+ with :
28
+ result-encoding : string
29
+ script : |
30
+ const supergraph_tag = require('.github/workflows/supergraph_tag.js');
31
+ const token = "${{ github.token }}";
32
+ return await supergraph_tag({github, context, token})
33
+
18
34
- name : Setup Helm
35
+ if : steps.version.outputs.result != ''
19
36
20
37
21
38
- name : Download Schema Artifact
39
+ if : steps.version.outputs.result != ''
22
40
23
41
with :
24
42
name : supergraph.graphql
25
43
path : charts/supergraph
26
44
27
- - name : Generate Chart Version
28
- id : version
29
- run : |
30
- if LATEST_TAG=$(git describe --tags --abbrev=0); then
31
- COMMITS_SINCE=$(git rev-list $LATEST_TAG..HEAD --count)
32
- else
33
- LATEST_TAG="0.0.0"
34
- COMMITS_SINCE=$(git rev-list HEAD --count)
35
- fi
36
- VERSION=$([ "$COMMITS_SINCE" == 0 ] && echo "$LATEST_TAG" || echo "$LATEST_TAG+$COMMITS_SINCE" )
37
- echo "Using Version: $VERSION"
38
- echo "version=$VERSION" >> $GITHUB_OUTPUT
39
-
40
45
- name : Package Chart
41
- run : helm package charts/supergraph --version "${{ steps.version.outputs.version }}"
46
+ if : steps.version.outputs.result != ''
47
+ run : helm package charts/supergraph --version ${{ steps.version.outputs.result }}
42
48
43
49
- name : Generate Image Name
50
+ if : steps.version.outputs.result != ''
44
51
run : |
45
52
IMAGE_REPOSITORY="oci://ghcr.io/$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]' | tr '[_]' '[\-]')"
46
53
echo "Using Image Name: $IMAGE_REPOSITORY"
47
54
echo "IMAGE_REPOSITORY=$IMAGE_REPOSITORY" >> $GITHUB_ENV
48
55
49
56
- name : Log in to GitHub Docker Registry
50
- if : github.event_name == 'push' && ( startsWith(github.ref, 'refs/tags') || startsWith(github.ref, 'refs/heads/main') )
57
+ if : steps.version.outputs.result != '' && github.event_name == 'push' && ( startsWith(github.ref, 'refs/tags') || startsWith(github.ref, 'refs/heads/main') )
51
58
52
59
with :
53
60
registry : ghcr.io
54
61
username : ${{ github.actor }}
55
62
password : ${{ secrets.GITHUB_TOKEN }}
56
63
57
64
- name : Publish Chart
58
- if : github.event_name == 'push' && ( startsWith(github.ref, 'refs/tags') || startsWith(github.ref, 'refs/heads/main') )
65
+ if : steps.version.outputs.result != '' && github.event_name == 'push' && ( startsWith(github.ref, 'refs/tags') || startsWith(github.ref, 'refs/heads/main') )
59
66
run : helm push $(ls supergraph-*.tgz) ${{ env.IMAGE_REPOSITORY }}
0 commit comments