Skip to content

update release workflow #6

update release workflow

update release workflow #6

name: Release Maubot Plugin
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Check out code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Extract version from maubot.yaml
run: |
VERSION=$(cat maubot.yaml | grep 'version' | cut -d ':' -f 2 | xargs)
echo "VERSION=$VERSION"
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Check if release already exists
run: |
RELEASE_EXIST=$(gh release view $VERSION > /dev/null 2>&1 && echo "true" || echo "false")
echo "RELEASE_EXIST=$RELEASE_EXIST"
echo "RELEASE_EXIST=$RELEASE_EXIST" >> $GITHUB_ENV
- name: Generate changelog
if: env.RELEASE_EXIST == 'false'
run: |
CHANGELOG=$(git log $(git describe --tags --abbrev=0)..HEAD --pretty=format:"- %s" -- base-config.yaml maubot.yaml socialmediadownload.py instaloader/)
echo "CHANGELOG=$(echo "$CHANGELOG" | base64)"
echo "CHANGELOG=$(echo "$CHANGELOG" | base64)" >> $GITHUB_ENV
- name: Create GitHub Release
id: create_release
if: env.RELEASE_EXIST == 'false'
uses: actions/create-release@v1
with:
tag_name: ${{ env.VERSION }}
release_name: Release ${{ env.VERSION }}
body: ${{ env.CHANGELOG }}
draft: false
prerelease: false