Skip to content

style: Call startswith or endswith once with a tuple (PIE810) (… #516

style: Call startswith or endswith once with a tuple (PIE810) (…

style: Call startswith or endswith once with a tuple (PIE810) (… #516

---
name: Create or check a release draft
on:
push:
branches:
- main
- releasebranch_*
tags:
- '**'
pull_request:
paths:
- .github/**
- utils/**
concurrency:
group: >-
${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
cancel-in-progress: true
env:
OUT_DIR: ${{ github.workspace }}/../grass_outdir
GRASS: grass-${{ github.ref_name }}
permissions: {}
jobs:
build:
name: Package and create release draft
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checks-out repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
ref: ${{ github.ref }}
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
with:
python-version: '3.11'
- name: Create output directory
run: |
mkdir ${{ env.OUT_DIR }}
- name: Generate ChangeLog file
run: |
python utils/gitlog2changelog.py
mv ChangeLog ${{ env.OUT_DIR }}/ChangeLog
gzip ${{ env.OUT_DIR }}/ChangeLog
- name: Generate Git derived data files
run: |
echo "Generate VERSION_GIT file:"
./utils/generate_version_git_file.sh
cat include/VERSION_GIT
echo "Generate GENERATE_LAST_COMMIT_FILE:"
python utils/generate_last_commit_file.py .
cat core_modules_with_last_commit.json
echo "Create core modules patch file:"
git add core_modules_with_last_commit.json
git diff --cached > \
${{ env.OUT_DIR }}/core_modules_with_last_commit.patch
- name: Create tarballs (for tags only)
if: startsWith(github.ref, 'refs/tags/')
run: |
cd ..
tar -cvf ${{ env.OUT_DIR }}/${{ env.GRASS }}.tar \
--exclude=".gi*" --exclude=".tr*" grass
cd ${{ env.OUT_DIR }}
gzip -9k ${{ env.GRASS }}.tar
md5sum ${{ env.GRASS }}.tar.gz > ${{ env.GRASS }}.tar.gz.md5
sha256sum ${{ env.GRASS }}.tar.gz > ${{ env.GRASS }}.tar.gz.sha256
xz -9e ${{ env.GRASS }}.tar
md5sum ${{ env.GRASS }}.tar.xz > ${{ env.GRASS }}.tar.xz.md5
sha256sum ${{ env.GRASS }}.tar.xz > ${{ env.GRASS }}.tar.xz.sha256
- name: Publish draft distribution to GitHub (for tags only)
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@c062e08bd532815e2082a85e87e3ef29c3e6d191 # v2.0.8
with:
name: GRASS GIS ${{ github.ref_name }}
body: |
Overview of changes
- First change
- Second change
draft: true
prerelease: ${{ contains(github.ref, 'RC') }}
files: |
${{ env.OUT_DIR }}/${{ env.GRASS }}.tar.gz
${{ env.OUT_DIR }}/${{ env.GRASS }}.tar.gz.md5
${{ env.OUT_DIR }}/${{ env.GRASS }}.tar.gz.sha256
${{ env.OUT_DIR }}/${{ env.GRASS }}.tar.xz
${{ env.OUT_DIR }}/${{ env.GRASS }}.tar.xz.md5
${{ env.OUT_DIR }}/${{ env.GRASS }}.tar.xz.sha256
${{ env.OUT_DIR }}/ChangeLog.gz
${{ env.OUT_DIR }}/core_modules_with_last_commit.patch