Repository navigation
80 lines (68 loc) · 2.72 KB
/
Copy pathrelease-assets.yml
File metadata and controls
80 lines (68 loc) · 2.72 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
name: Release Assets
on:
push:
tags:
- 'v*'
permissions:
contents: write
jobs:
release:
name: Create Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up Python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: '3.11'
cache: 'pip'
- name: Set up Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: '20'
- name: Install dependencies
run: |
pip install -r requirements-dev.txt
npm install -g @openapitools/openapi-generator-cli openapi-to-postmanv2
- name: Generate OpenAPI
run: python scripts/generate_openapi.py
- name: Generate Postman collection
run: bash scripts/generate_postman.sh || echo "Postman generation failed, continuing..."
- name: Get product info
id: product
run: |
NAME=$(python3 -c "import yaml; print(yaml.safe_load(open('product.yaml'))['product']['display_name'])")
VERSION=${GITHUB_REF#refs/tags/v}
echo "NAME=$NAME" >> $GITHUB_OUTPUT
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
- name: Create release archive
run: |
mkdir -p release-assets
cp openapi/openapi.yaml release-assets/ 2>/dev/null || true
cp openapi/openapi.json release-assets/ 2>/dev/null || true
cp postman/collection.json release-assets/ 2>/dev/null || true
cd release-assets && zip -r ../release-${{ steps.product.outputs.VERSION }}.zip . && cd ..
- name: Extract changelog for release
id: changelog
run: |
if [ -f CHANGELOG.md ]; then
# Extract changelog section for this version
awk '/^## \['"${{ steps.product.outputs.VERSION }}"'\]/{flag=1; next} /^## \[/{flag=0} flag' CHANGELOG.md > release-notes.md
if [ ! -s release-notes.md ]; then
echo "Release ${{ steps.product.outputs.VERSION }}" > release-notes.md
fi
else
echo "Release ${{ steps.product.outputs.VERSION }}" > release-notes.md
fi
- name: Create GitHub Release
uses: softprops/action-gh-release@3d0d9888cb7fd7b750713d6e236d1fcb99157228 # v3.0.2
with:
name: ${{ steps.product.outputs.NAME }} v${{ steps.product.outputs.VERSION }}
body_path: release-notes.md
files: |
release-${{ steps.product.outputs.VERSION }}.zip
openapi/openapi.yaml
openapi/openapi.json
postman/collection.json
draft: false
prerelease: false