1+ name : generate and publish manifest
2+
3+ on :
4+ push :
5+ tags : [ 'v*' ]
6+
7+ jobs :
8+ generate-manifest-json :
9+ runs-on : ubuntu-latest
10+ steps :
11+ - name : Set repo name
12+ run : |
13+ echo "REPO_NAME=$(echo ${{ github.repository }} | cut -d'/' -f2)" >> $GITHUB_ENV
14+ echo "VERSION=$(echo ${{ github.ref }} | cut -d'/' -f3 | cut -c2-)" >> $GITHUB_ENV
15+ - uses : actions/checkout@v2
16+
17+ - name : Set up Lua
18+ uses : leafo/gh-actions-lua@v8
19+ with :
20+ luaVersion : ' 5.3.5'
21+
22+ - name : Install dependencies
23+ run : |
24+ sudo apt-get install luarocks
25+ sudo luarocks install dkjson
26+
27+ - name : Generate manifest
28+ run : |
29+ sudo lua -e '
30+ require("metadata");
31+ local dkjson = require("dkjson");
32+ PLUGIN.download_url = "https://github.com/${{ github.repository }}/releases/download/v${{ env.VERSION }}/${{ env.REPO_NAME }}_${{ env.VERSION }}.zip";
33+ local str = dkjson.encode(PLUGIN);
34+ print(str)' > manifest.json
35+ cat manifest.json
36+ - name : Upload JSON file
37+ uses : actions/upload-artifact@v2
38+ with :
39+ name : manifest
40+ path : manifest.json
41+ release-plugin-and-manifest :
42+ needs : generate-manifest-json
43+ runs-on : ubuntu-latest
44+ steps :
45+ - name : Set repo name
46+ run : |
47+ echo "REPO_NAME=$(echo ${{ github.repository }} | cut -d'/' -f2)" >> $GITHUB_ENV
48+ echo "VERSION=$(echo ${{ github.ref }} | cut -d'/' -f3 | cut -c2-)" >> $GITHUB_ENV
49+ - name : Checkout code
50+ uses : actions/checkout@v2
51+ - name : Download JSON file
52+ uses : actions/download-artifact@v2
53+ with :
54+ name : manifest
55+ - name : Compress build files
56+ uses : thedoctor0/zip-release@0.7.6
57+ with :
58+ type : " zip"
59+ directory : " ./"
60+ filename : " ${{ env.REPO_NAME }}_${{ env.VERSION }}.zip"
61+ exclusions : " *.git* "
62+ - name : Publish release
63+ uses : svenstaro/upload-release-action@v2
64+ with :
65+ repo_token : ${{ secrets.GITHUB_TOKEN }}
66+ file : ./${{ env.REPO_NAME }}_${{ env.VERSION }}.zip
67+ tag : v${{ env.VERSION }}
68+ file_glob : true
69+ - name : Publish manifest
70+ uses : svenstaro/upload-release-action@v2
71+ with :
72+ repo_token : ${{ secrets.GITHUB_TOKEN }}
73+ file : ./manifest.json
74+ tag : " manifest"
75+ overwrite : true
76+ file_glob : true
0 commit comments