-
Notifications
You must be signed in to change notification settings - Fork 5
119 lines (102 loc) · 3.93 KB
/
release.yml
File metadata and controls
119 lines (102 loc) · 3.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
name: Create Release
on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
tag:
description: 'Tag to release (e.g., v1.4.0)'
required: true
type: string
permissions:
contents: write
jobs:
build-and-release:
name: Build and Release
runs-on: ubuntu-22.04
container:
image: qgis/qgis:release-3_34
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Fix Python command
run: apt-get update && apt-get install -y python-is-python3 python3-pip
- name: Install plugin dependencies
run: pip3 install -r requirements-dev.txt
- name: Get plugin metadata
id: metadata
run: |
VERSION=$(python3 -c "import json; f = open('config.json'); data=json.load(f); print(data['general']['version'])")
IS_EXPERIMENTAL=$(python3 -c "import json; f = open('config.json'); data=json.load(f); print(str(data['general']['experimental']).lower())")
PLUGIN_NAME=$(python3 -c "import json; f = open('config.json'); data=json.load(f); print(data['general']['name'])")
echo "VERSION=$VERSION" >> "$GITHUB_OUTPUT"
echo "IS_EXPERIMENTAL=$IS_EXPERIMENTAL" >> "$GITHUB_OUTPUT"
echo "PLUGIN_NAME=$PLUGIN_NAME" >> "$GITHUB_OUTPUT"
- name: Generate plugin zip
run: python3 admin.py generate-zip
- name: Get zip details
id: zip-details
run: |
ZIP_NAME=$(ls dist)
echo "ZIP_PATH=dist/$ZIP_NAME" >> "$GITHUB_OUTPUT"
echo "ZIP_NAME=$ZIP_NAME" >> "$GITHUB_OUTPUT"
- name: Extract release notes from CHANGELOG
id: release-notes
run: |
# Extract the latest version section from CHANGELOG.md
if [ -f CHANGELOG.md ]; then
# Get content between first and second version headers
NOTES=$(awk '/^## \[?[0-9]/{if(found)exit; found=1; next} found{print}' CHANGELOG.md | head -50)
if [ -z "$NOTES" ]; then
NOTES="See CHANGELOG.md for details."
fi
else
NOTES="Release ${{ steps.metadata.outputs.VERSION }}"
fi
# Write to file to preserve formatting
echo "$NOTES" > release_notes.txt
- name: Create release and upload asset
uses: softprops/action-gh-release@v2
with:
name: ${{ steps.metadata.outputs.PLUGIN_NAME }} ${{ github.ref_name }}
tag_name: ${{ github.ref_name }}
prerelease: ${{ steps.metadata.outputs.IS_EXPERIMENTAL }}
draft: false
body_path: release_notes.txt
files: |
${{ steps.zip-details.outputs.ZIP_PATH }}
fail_on_unmatched_files: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
update-plugin-repo:
name: Update Plugin Repository
runs-on: ubuntu-22.04
needs: build-and-release
container:
image: qgis/qgis:release-3_34
steps:
- name: Checkout release branch
uses: actions/checkout@v4
with:
ref: release
fetch-depth: 0
- name: Fix Python command
run: apt-get update && apt-get install -y python-is-python3 python3-pip
- name: Install dependencies
run: pip3 install -r requirements-dev.txt
- name: Update plugin repository XML
run: |
python3 admin.py --verbose generate-plugin-repo-xml
# Add newline to ensure clean git diff
echo "" >> docs/repository/plugins.xml
- name: Commit and push
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global --add safe.directory /__w/QGISAnimationWorkbench/QGISAnimationWorkbench
git add -A
git diff --staged --quiet || git commit -m "Update plugins.xml for ${{ github.ref_name }}"
git push origin release