Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: create release draft on tag #44

Merged
merged 2 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 49 additions & 10 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,77 @@
---
name: Publish gdal-grass driver
name: Create or check a release draft

on:
release:
types: [published]
push:
branches:
- main
tags:
- '**'
pull_request:
branches:
- main
paths:
- .github/**
- utils/**
env:
OUT_DIR: ${{ github.workspace }}/.g_outdir
OUT_DIR: ${{ github.workspace }}/../g_outdir
GDAL-GRASS: gdal-grass-${{ github.ref_name }}
permissions:
contents: write
jobs:
build-n-publish:
name: Build and publish gdal-grass driver
name: Package and create release draft
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: ${{ github.ref }}
- name: Create tarballs
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: '3.11'
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
python -m pip install PyYAML
- name: Create output directory
run: |
mkdir ${{ env.OUT_DIR }}
- name: Generate ChangeLog file
run: |
lasttag=""
for tag in $(git tag -n --sort=-creatordate | cut -d' ' -f 1); do
if [[ $tag != *"RC"* && $tag != ${{ github.ref_name }} ]]; then
lasttag="$tag"
break
fi
done
echo "Creating CHANGELOG since v$lasttag"
echo "$(python ./utils/generate_release_notes.py log main \
$lasttag ${{ github.ref_name }})" >> ${{ env.OUT_DIR }}/CHANGELOG
- name: Create tarballs (for tags only)
if: startsWith(github.ref, 'refs/tags/')
run: |
cd ..
tar -cvf ${{ env.OUT_DIR }}/${{ env.GDAL-GRASS }}.tar --exclude=".g*" gdal-grass
tar -cvf ${{ env.OUT_DIR }}/${{ env.GDAL-GRASS }}.tar --exclude=".g*" \
--transform s/gdal-grass/${{ env.GDAL-GRASS }}/ gdal-grass
cd ${{ env.OUT_DIR }}
gzip -9k ${{ env.GDAL-GRASS }}.tar
md5sum ${{ env.GDAL-GRASS }}.tar.gz > ${{ env.GDAL-GRASS }}.tar.gz.md5
sha256sum ${{ env.GDAL-GRASS }}.tar.gz > ${{ env.GDAL-GRASS }}.tar.gz.sha256
xz -9e ${{ env.GDAL-GRASS }}.tar
md5sum ${{ env.GDAL-GRASS }}.tar.xz > ${{ env.GDAL-GRASS }}.tar.xz.md5
sha256sum ${{ env.GDAL-GRASS }}.tar.xz > ${{ env.GDAL-GRASS }}.tar.xz.sha256
- name: Publish distribution to GitHub
uses: softprops/action-gh-release@v2
- name: Publish draft release to GitHub (for tags only)
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@01570a1f39cb168c169c802c3bceb9e93fb10974 # v2.1.0
with:
name: GDAL-GRASS GIS driver ${{ github.ref_name }}
body_path: ${{ env.OUT_DIR }}/CHANGELOG
draft: true
prerelease: ${{ contains(github.ref, 'RC') }}
files: |
${{ env.OUT_DIR }}/${{ env.GDAL-GRASS }}.tar.gz
${{ env.OUT_DIR }}/${{ env.GDAL-GRASS }}.tar.gz.md5
Expand Down
2 changes: 1 addition & 1 deletion utils/generate_release_notes.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def print_notes(
"""
num_changes = round_down_to_five(len(changes))
print(
f"The gdal-grass {end_tag} release provides more than "
f"The GDAL-GRASS driver {end_tag} release provides more than "
f"{num_changes} improvements and fixes "
f"with respect to the release {start_tag}.\n"
)
Expand Down
Loading