1
+ name : Create release
2
+
3
+ on :
4
+ workflow_dispatch :
5
+ inputs :
6
+ program :
7
+ description : Program
8
+ required : true
9
+ default : core
10
+ type : choice
11
+ options :
12
+ - core
13
+ bump :
14
+ description : Version bump
15
+ required : true
16
+ default : patch
17
+ type : choice
18
+ options :
19
+ - patch
20
+ - minor
21
+ - major
22
+ git_ref :
23
+ description : Commit hash or branch to create release
24
+ required : false
25
+ type : string
26
+ default : main
27
+
28
+
29
+ env :
30
+ CACHE : true
31
+
32
+ jobs :
33
+ build_programs :
34
+ name : Programs
35
+ uses : ./.github/workflows/build-programs.yml
36
+ secrets : inherit
37
+ with :
38
+ git_ref : ${{ inputs.git_ref }}
39
+
40
+ test_js :
41
+ name : JS client
42
+ needs : build_programs
43
+ uses : ./.github/workflows/test-js-client.yml
44
+ secrets : inherit
45
+ with :
46
+ git_ref : ${{ inputs.git_ref }}
47
+
48
+ create_release :
49
+ name : Create program release
50
+ runs-on : ubuntu-latest
51
+ needs : test_js
52
+ permissions :
53
+ contents : write
54
+ steps :
55
+ - name : Git checkout
56
+ uses : actions/checkout@v4
57
+ with :
58
+ ref : ${{ inputs.git_ref }}
59
+ - name : Bump Program Version
60
+ run : |
61
+ git fetch --tags --all
62
+ VERSION=`git tag -l --sort -version:refname "release/${{ inputs.program }}@*" | head -n 1 | sed 's|release/${{ inputs.program }}@||'`
63
+ MAJOR=`echo ${VERSION} | cut -d. -f1`
64
+ MINOR=`echo ${VERSION} | cut -d. -f2`
65
+ PATCH=`echo ${VERSION} | cut -d. -f3`
66
+
67
+ if [ "${{ inputs.bump }}" == "major" ]; then
68
+ MAJOR=$((MAJOR + 1))
69
+ MINOR=0
70
+ PATCH=0
71
+ elif [ "${{ inputs.bump }}" == "minor" ]; then
72
+ MINOR=$((MINOR + 1))
73
+ PATCH=0
74
+ else
75
+ PATCH=$((PATCH + 1))
76
+ fi
77
+
78
+ PROGRAM_VERSION="${MAJOR}.${MINOR}.${PATCH}"
79
+
80
+ echo PROGRAM_VERSION="${PROGRAM_VERSION}" >> $GITHUB_ENV
81
+
82
+ - name : Download Program Builds
83
+ uses : actions/download-artifact@v4
84
+ with :
85
+ name : program-builds-${{ inputs.git_ref }}
86
+
87
+ - name : Identify Program
88
+ run : |
89
+ PROGRAM_NAME="mpl_core" >> $GITHUB_ENV
90
+
91
+ - name : Create Release
92
+ id : create_release
93
+ uses : actions/create-release@v1
94
+ env :
95
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
96
+ with :
97
+ tag_name : release/${{ inputs.program }}@${{ env.PROGRAM_VERSION }}
98
+ release_name : ${{ inputs.program }} v${{ env.PROGRAM_VERSION }}
99
+ body : |
100
+ Release ${{ inputs.program }} v${{ env.PROGRAM_VERSION }}
101
+ draft : false
102
+ prerelease : false
103
+
104
+ - name : Upload Release Asset
105
+ uses : actions/upload-release-asset@v1
106
+ env :
107
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
108
+ with :
109
+ upload_url : ${{ steps.create_release.outputs.upload_url }}
110
+ asset_path : ./programs/.bin/${{ env.PROGRAM_NAME }}.so
111
+ asset_name : ${{ env.PROGRAM_NAME }}.so
112
+ asset_content_type : application/octet-stream
113
+
114
+ # - name: Update latest tag
115
+ # uses: actions/github-script@v5
116
+ # with:
117
+ # script: |
118
+ # github.rest.git.createRef({
119
+ # owner: context.repo.owner,
120
+ # repo: context.repo.repo,
121
+ # ref: 'refs/tags/release/${{ inputs.program }}@latest',
122
+ # sha: '${{ github.sha }}'
123
+ # });
0 commit comments