maple-font/.github/workflows/release.yml
2024-12-03 18:02:53 +08:00

70 lines
1.9 KiB
YAML

name: Release Font
on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
options:
description: 'Options for build.py'
required: false
default: ''
cn:
description: 'Include Chinese version'
required: false
default: 'false'
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Checkout branch
run: git checkout variable
- name: Install ftcli
run: python -m pip install foundrytools-cli
- name: Run release script
run: |
if [ "${{ github..event_name }}" == "push" ]; then
python release.py
else
options="${{ github.event.inputs.options }}"
if [ "${{ github.event.inputs.cn }}" == "true" ]; then
options="$options --cn"
fi
python build.py $options
fi
- name: Generate release notes
id: release_notes
run: |
if [ "${{ github.event_name }}" == "push" ]; then
echo "notes=$(git log --pretty=%B $(git describe --tags --abbrev=0)..HEAD)" >> $GITHUB_ENV
else
notes=$(python release.py ${{ github.event.inputs.options }} --dry)
echo "notes=### Configuration:\n\n```\n$notes\n```" >> $GITHUB_ENV
- name: Generate tag name
id: generate_timestamp
run: echo "::set-output name=tag_name::v$(date +%s)"
- name: Create release
id: create_release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref_name || steps.generate_timestamp.outputs.tag_name }}
draft: ${{ github.event_name == 'push' }}
body: ${{ env.notes }}
token: ${{ secrets.GITHUB_TOKEN }}
file: |
release/*