add github actions
This commit is contained in:
41
.github/workflows/release.yml
vendored
Normal file
41
.github/workflows/release.yml
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
name: Release Plugin Zip
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "v*"
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Build plugin zip
|
||||
id: build
|
||||
run: |
|
||||
set -euo pipefail
|
||||
PLUGIN_SLUG="${GITHUB_REPOSITORY##*/}"
|
||||
TAG="${GITHUB_REF_NAME}"
|
||||
ZIP_NAME="${PLUGIN_SLUG}-${TAG}.zip"
|
||||
|
||||
mkdir -p dist
|
||||
git archive --format=zip --prefix="${PLUGIN_SLUG}/" -o "dist/${ZIP_NAME}" HEAD
|
||||
|
||||
echo "zip_path=dist/${ZIP_NAME}" >> "$GITHUB_OUTPUT"
|
||||
echo "zip_name=${ZIP_NAME}" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Create release and upload zip
|
||||
uses: softprops/action-gh-release@v2
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag_name: ${{ github.ref_name }}
|
||||
name: ${{ github.ref_name }}
|
||||
generate_release_notes: true
|
||||
files: ${{ steps.build.outputs.zip_path }}
|
||||
Reference in New Issue
Block a user