Skip to content

Create a release

Create a release #24

Workflow file for this run

# SPDX-FileCopyrightText: 2017-2024 City of Espoo
#
# SPDX-License-Identifier: LGPL-2.1-or-later
name: 'Create a release'
on:
schedule:
- cron: '0 23 * * 0' # Sunday at 23:00
workflow_dispatch:
inputs:
git-tag:
description: "Git tag for the release"
required: true
target:
description: "Branch name or commit id to create the tag on"
required: true
default: "master"
start-date:
description: "Include PRs starting from date, YYYY-MM-DD"
required: true
end-date:
description: "Include PRs up to date (inclusive), YYYY-MM-DD"
required: true
draft:
description: "Create a draft release (true/false)"
required: true
default: "false"
env:
GH_TOKEN: ${{ github.token }}
jobs:
config:
runs-on: ubuntu-latest
steps:
- id: config
run: |
echo "tag=${{ inputs.git-tag || 'v$(date ''+%Y%m%d'')' }}" >> "$GITHUB_OUTPUT"
echo "target=${{ inputs.target || 'master' }}" >> "$GITHUB_OUTPUT"
echo "start-date=${{ inputs.start-date || '$(date --date ''-6 days'' ''+%Y-%m-%d'')' }}" >> "$GITHUB_OUTPUT"
echo "end-date=${{ inputs.end-date || '$(date ''+%Y-%m-%d'')' }}" >> "$GITHUB_OUTPUT"
echo "draft=${{ inputs.draft || 'false' }}" >> "$GITHUB_OUTPUT"
outputs:
changelog-args: ${{ steps.config.outputs.start-date }} ${{ steps.config.outputs.end-date }}
gh-args: ${{ steps.config.outputs.draft == 'true' && '--draft' || '' }} --target ${{ steps.config.outputs.target }} --title ${{ steps.config.outputs.tag }} ${{ steps.config.outputs.tag }}
release:
runs-on: ubuntu-latest
needs:
- config
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- run: |
gh pr list \
--base master \
--state merged \
--limit 300 \
--json title,labels,closedAt,number,url |\
bin/changelog.js ${{ needs.config.outputs.changelog-args }} |\
gh release create --notes-file - ${{ needs.config.outputs.gh-args }}