InvenTree/.github/workflows/do_release.yaml
2024-03-01 00:26:30 +01:00

68 lines
2.4 KiB
YAML

name: Publish a new release
on:
workflow_dispatch:
inputs:
target:
description: Which kind of release is this?
required: true
type: choice
default: "stable"
options:
- "master"
- "stable"
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v2
- name: Set up environment
run: pip install requests >/dev/null 2>&1
- name: Gather version information
id: version
env:
TARGET: ${{ github.event.inputs.target }}
run: |
python3 ci/version_check.py do_release
cat $GITHUB_OUTPUT
- name: Gather auto-text
id: auto_text
run: |
auto_text=$(curl -s -S -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.RELEASE_PAT }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/inventree/InvenTree/releases/generate-notes \
-d '{"tag_name":"${{ steps.version.outputs.tag }}","target_commitish":"${{ steps.version.outputs.old_branch }}","previous_tag_name":"${{ steps.version.outputs.old_version }}"}')
echo $auto_text
echo $auto_text >> $GITHUB_STEP_SUMMARY
{
echo 'auto_text<<EOF'
$auto_text
EOF
} >> "$GITHUB_OUTPUT"
- name: "Dummy: Set version"
run: echo "Change version to ${{ steps.version.outputs.tag }}"
- name: "Dummy: Update changelog header"
id: changelog
run: |
echo "Update changelog to ${{ steps.version.outputs.tag }}"
echo "changelog_text=$(grep 'version' setup.py | cut -d "'" -f 2)" >> $GITHUB_OUTPUT
- name: "Dummy: Push changes"
run: echo "Push changes to ${{ github.event.inputs.target }}"
- name: "Dummy: Create release"
run: |
echo "Creating release for ${{ steps.version.outputs.tag }} on branch ${{ github.event.inputs.target }}"
echo "Branch text:
${{ steps.changelog.outputs.changelog_text }}
${{ steps.auto_text.outputs.auto_text }}"
- name: "Dummy: Bumpy version on master"
if: github.event.inputs.target == 'master'
run: echo "Bumping version on master to ${{ steps.version.outputs.new_tag }}"