-
Notifications
You must be signed in to change notification settings - Fork 0
70 lines (59 loc) · 2 KB
/
release.yml
File metadata and controls
70 lines (59 loc) · 2 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
name: Release - Create Archive
on:
push:
tags:
- 'v*.*.*'
jobs:
release:
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Get tag name
id: tag
run: echo "TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Create .env.example in archive
run: |
# Ensure .env.example exists for users
if [ ! -f .env.example ]; then
echo ".env.example not found!"
exit 1
fi
- name: Create release archive
run: |
# Create clean archive without dev files (uses .gitattributes)
git archive --format=zip --prefix=DockerStackTraefik/ -o DockerStackTraefik.zip HEAD
- name: Extract changelog for this release
id: changelog
run: |
# Try to extract changelog from CHANGELOG.md
if [ -f CHANGELOG.md ]; then
# Extract section for this version
VERSION=${{ steps.tag.outputs.TAG }}
awk "/## $VERSION/,/## [0-9]/" CHANGELOG.md | sed '$d' > release-notes.md
# If empty, use tag message
if [ ! -s release-notes.md ]; then
git tag -l --format='%(contents)' $VERSION > release-notes.md
fi
else
git tag -l --format='%(contents)' ${{ steps.tag.outputs.TAG }} > release-notes.md
fi
# Show what we got
cat release-notes.md
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
name: Release ${{ steps.tag.outputs.TAG }}
body_path: release-notes.md
files: DockerStackTraefik.zip
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload artifact for verification
uses: actions/upload-artifact@v3
with:
name: release-archive
path: DockerStackTraefik.zip
retention-days: 30