Skip to content

Commit d17be59

Browse files
authored
Generate Manifest and Publish (#1)
1 parent fd312b5 commit d17be59

2 files changed

Lines changed: 88 additions & 5 deletions

File tree

.github/workflows/publish.yaml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
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

metadata.lua

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,26 @@ PLUGIN = {}
55
--- Plugin name
66
PLUGIN.name = "java"
77
--- Plugin author
8-
PLUGIN.author = "Lihan"
8+
PLUGIN.author = "your name"
99
--- Plugin version
1010
PLUGIN.version = "0.0.1"
11-
-- Update URL
12-
PLUGIN.updateUrl = "{URL}/sdk.lua"
13-
14-
--- !!! OPTIONAL !!!
11+
--- Plugin repository
12+
PLUGIN.homepage = "https://github.com/version-fox/vfox-plugin-template"
13+
--- Plugin license
14+
PLUGIN.license = "MIT"
1515
--- Plugin description
1616
PLUGIN.description = "xxx"
17+
18+
--- !!! OPTIONAL !!!
1719
-- minimum compatible vfox version
1820
PLUGIN.minRuntimeVersion = "0.2.2"
1921
-- legacy filenames
2022
PLUGIN.legacyFilenames = {
2123
".nvmrc",
2224
".node-version",
2325
}
26+
27+
PLUGIN.notes ={
28+
"some thing",
29+
"some thing",
30+
}

0 commit comments

Comments
 (0)