70 lines
2.0 KiB
YAML
70 lines
2.0 KiB
YAML
name: Build Maubot Plugin
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
tags: ["v*"]
|
|
pull_request:
|
|
branches: [main]
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: dock.mau.dev/maubot/maubot:latest
|
|
steps:
|
|
- name: Install dependencies
|
|
run: |
|
|
apk add --no-cache git nodejs
|
|
|
|
- name: Checkout
|
|
run: |
|
|
git clone --depth 1 --branch "${GITHUB_REF_NAME}" "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git" . || \
|
|
git clone --depth 1 "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git" . && git checkout "${GITHUB_SHA}"
|
|
|
|
- name: Determine version
|
|
id: version
|
|
run: |
|
|
if [ -n "$GITHUB_REF_NAME" ] && echo "$GITHUB_REF_NAME" | grep -q '^v'; then
|
|
VERSION="${GITHUB_REF_NAME#v}"
|
|
else
|
|
SHORT_SHA=$(echo "$GITHUB_SHA" | cut -c1-8)
|
|
VERSION="${GITHUB_REF_NAME}-${SHORT_SHA}"
|
|
fi
|
|
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
|
|
echo "Building version: $VERSION"
|
|
|
|
- name: Build .mbp plugin
|
|
run: mbc build -o "cloud.catgirl.ntfy-${{ steps.version.outputs.version }}-edit-by-scriptos.mbp"
|
|
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: maubot-ntfy-plugin
|
|
path: "*.mbp"
|
|
|
|
release:
|
|
runs-on: ubuntu-latest
|
|
needs: build
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
|
steps:
|
|
- name: Download artifact
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
name: maubot-ntfy-plugin
|
|
|
|
- name: Create Gitea Release
|
|
uses: actions/forgejo-release@v2
|
|
with:
|
|
direction: upload
|
|
url: ${{ github.server_url }}
|
|
repo: ${{ github.repository }}
|
|
tag: ${{ github.ref_name }}
|
|
title: "Release ${{ github.ref_name }}"
|
|
token: ${{ secrets.REGISTRY_TOKEN }}
|
|
release-dir: .
|
|
release-notes: |
|
|
Maubot ntfy Plugin ${{ github.ref_name }}
|
|
|
|
Install the `.mbp` file via the Maubot admin interface.
|