Skip to content

Workflow file for this run

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/zip-release@0.7.6
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