Skip to content

workflow adjusted

workflow adjusted #7

Workflow file for this run

name: Create Release
on:
push:
tags:
- '*.*.*' # Triggers on tags like 1.0.0
branches:
- master # Ensures it only runs on the master branch
jobs:
create_release:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Read version from readme.txt
id: read_version
run: |
VERSION=$(grep -Eo 'Stable tag: [0-9]+\.[0-9]+\.[0-9]+' readme.txt | awk '{print $3}')
echo "plugin_version=$VERSION" >> $GITHUB_ENV
- name: Get latest tag
id: get_latest_tag
run: |
LATEST_TAG=$(git describe --tags `git rev-list --tags --max-count=1`)
echo "latest_tag=$LATEST_TAG" >> $GITHUB_ENV
- name: Extract Changelog
id: extract_changelog
run: |
START_LINE=$(grep -n "== Changelog ==" readme.txt | cut -d : -f 1)
END_LINE=$(grep -n "= ${{ env.plugin_version }} =" readme.txt | cut -d : -f 1)
sed -n "${START_LINE},${END_LINE}p" readme.txt | sed '1d;$d' > CHANGELOG.txt
echo "changelog=$(cat CHANGELOG.txt)" >> $GITHUB_ENV
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.latest_tag }}
release_name: "Release ${{ env.plugin_version }}"
body: ${{ env.changelog }}
draft: false
prerelease: false