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