82 lines
3.1 KiB
YAML
82 lines
3.1 KiB
YAML
name: Create Release
|
|
|
|
# Runs automatically when a release/vX.Y.Z PR (opened by the Prepare Release
|
|
# workflow) is merged into master. Manual escape hatches: dispatch directly or
|
|
# push a version tag - both release whatever version AppSettings.php declares.
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
tags:
|
|
- '*'
|
|
pull_request:
|
|
types: [closed]
|
|
branches:
|
|
- master
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
build_release:
|
|
name: build_release
|
|
if: github.event_name != 'pull_request' || (github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'release/'))
|
|
runs-on: ubuntu-24.04
|
|
steps:
|
|
# On pull_request events github.sha points at a transient PR merge ref,
|
|
# not the commit that landed on master - build and tag merge_commit_sha.
|
|
- name: checkout
|
|
uses: actions/checkout@v5
|
|
with:
|
|
fetch-depth: 0
|
|
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.merge_commit_sha || github.ref }}
|
|
|
|
# Same PHP setup as Makefile CI - the runner's stock ext-redis (5.3.7)
|
|
# conflicts with symfony/cache >= 7.4, which requires ext-redis >= 6.1.
|
|
- name: Setup PHP
|
|
uses: shivammathur/setup-php@v2
|
|
with:
|
|
php-version: '8.3'
|
|
extensions: redis, gd, ldap, mbstring, pdo_mysql, zip, bcmath, exif, pcntl
|
|
|
|
- name: version
|
|
run: echo "version=$(make get-version)" >> $GITHUB_OUTPUT
|
|
id: version
|
|
|
|
# COMPOSER_AUTH prevents GitHub API rate-limiting; without it composer silently
|
|
# falls back to source (git clone) installs, shipping .git dirs and package build/
|
|
# test artifacts that ballooned release archives (#3330).
|
|
- name: build artifacts
|
|
run: make package
|
|
env:
|
|
COMPOSER_AUTH: '{"github-oauth": {"github.com": "${{ github.token }}"}}'
|
|
|
|
- name: Extract changelog section
|
|
run: |
|
|
awk '/^# Version:/{n++} n==1' CHANGELOG.md > "$RUNNER_TEMP/release-body.md"
|
|
if ! grep -q "Version: ${{ steps.version.outputs.version }}" "$RUNNER_TEMP/release-body.md"; then
|
|
echo "::warning::Top CHANGELOG.md section does not match v${{ steps.version.outputs.version }}; falling back to auto-generated notes only"
|
|
: > "$RUNNER_TEMP/release-body.md"
|
|
fi
|
|
|
|
- name: release
|
|
uses: ncipollo/release-action@v1
|
|
id: create_release
|
|
with:
|
|
token: ${{ github.token }}
|
|
draft: false
|
|
prerelease: false
|
|
name: Leantime v${{ steps.version.outputs.version }}
|
|
tag: v${{ steps.version.outputs.version }}
|
|
commit: ${{ github.event_name == 'pull_request' && github.event.pull_request.merge_commit_sha || github.sha }}
|
|
generateReleaseNotes: true
|
|
makeLatest: true
|
|
bodyFile: ${{ runner.temp }}/release-body.md
|
|
artifacts: './target/Leantime-v${{ steps.version.outputs.version }}.zip,./target/Leantime-v${{ steps.version.outputs.version }}.tar.gz'
|
|
|
|
- name: Run latest-tag
|
|
uses: EndBug/latest-tag@latest
|
|
with:
|
|
ref: latest
|
|
description: Latest Release of Leantime.
|