-
Notifications
You must be signed in to change notification settings - Fork 0
148 lines (126 loc) · 4.57 KB
/
Copy pathrelease.yml
File metadata and controls
148 lines (126 loc) · 4.57 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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
name: Release
on:
push:
tags:
- 'v*.*.*'
permissions:
contents: write
jobs:
build:
name: Build Release Artifacts
runs-on: ubuntu-latest
outputs:
version: ${{ steps.get_version.outputs.version }}
steps:
- name: Checkout code
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
fetch-depth: 0
- name: Get version from tag
id: get_version
run: |
VERSION=${GITHUB_REF#refs/tags/}
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "Version: ${VERSION}"
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y jq curl git
- name: Prepare release (update CHANGELOG)
run: |
chmod +x scripts/prepare-release.sh
# CHANGELOG may already be prepared by 'aicommit --release'; skip gracefully
if sed -n '/## \[Unreleased\]/,/^## \[/p' CHANGELOG.md | grep -q "^###"; then
./scripts/prepare-release.sh ${{ steps.get_version.outputs.version }}
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add CHANGELOG.md
git commit -m "chore(release): update CHANGELOG for ${{ steps.get_version.outputs.version }}" || true
else
echo "CHANGELOG [Unreleased] section is empty -- already prepared. Skipping."
fi
- name: Create release tarball
run: |
mkdir -p dist
tar -czf dist/aicommit-${{ steps.get_version.outputs.version }}.tar.gz \
aicommit install.sh README.md LICENSE CHANGELOG.md
- name: Copy standalone script
run: cp aicommit dist/aicommit
- name: Extract release notes
run: |
chmod +x scripts/extract-release-notes.sh
./scripts/extract-release-notes.sh ${{ steps.get_version.outputs.version }} > dist/release_notes.md
cat dist/release_notes.md
- name: Generate checksums
run: |
cd dist
sha256sum aicommit aicommit-*.tar.gz > SHA256SUMS
cat SHA256SUMS
- name: Upload artifacts
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: release-artifacts
path: dist/
github-release:
name: Create GitHub Release
needs: build
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
name: release-artifacts
path: dist/
- name: Display release notes
run: |
echo "Release notes for ${{ needs.build.outputs.version }}:"
cat dist/release_notes.md
- name: Create GitHub Release
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v1
with:
tag_name: ${{ needs.build.outputs.version }}
name: ${{ needs.build.outputs.version }}
body_path: dist/release_notes.md
files: |
dist/aicommit
dist/aicommit-${{ needs.build.outputs.version }}.tar.gz
dist/SHA256SUMS
draft: false
prerelease: false
debian-package:
name: Build Debian Package
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Install fpm
run: sudo gem install fpm
- name: Build .deb package
run: |
chmod +x scripts/build-deb.sh
./scripts/build-deb.sh ${{ needs.build.outputs.version }}
- name: Upload to release
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v1
with:
tag_name: ${{ needs.build.outputs.version }}
files: aicommit_*.deb
rpm-package:
name: Build RPM Package
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Install fpm and rpm tools
run: |
sudo gem install fpm
sudo apt-get update
sudo apt-get install -y rpm
- name: Build .rpm package
run: |
chmod +x scripts/build-rpm.sh
./scripts/build-rpm.sh ${{ needs.build.outputs.version }}
- name: Upload to release
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v1
with:
tag_name: ${{ needs.build.outputs.version }}
files: aicommit-*.rpm