-
Notifications
You must be signed in to change notification settings - Fork 35
98 lines (82 loc) · 3.41 KB
/
release-zips.yml
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
name: "🚀 Generate Examples Zips and Create Release"
on:
push:
branches:
- trunk # Or your default branch
workflow_dispatch:
jobs:
zip-packages:
runs-on: ubuntu-latest
steps:
# Checkout the repository
- name: Checkout code
uses: actions/checkout@v3
# Set up Node.js and install dependencies
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '16' # Use your preferred Node.js version
- uses: pnpm/action-setup@v4
with:
version: 8.7.1
- name: Install dependencies
run: pnpm install
# Create zips directory
- name: Create zips directory
run: mkdir -p zips
# Run the plugin-zip script to generate zip files
- name: Generate zip files
run: |
npm run deploy
ls -la zips/ # Debug: List contents of zips directory
# Install GitHub CLI
- name: Install GitHub CLI
run: sudo apt-get install -y gh
# Authenticate with GitHub CLI
- name: Authenticate GitHub CLI
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh auth setup-git -h github.com
# Create GitHub Release
- name: Create GitHub Release
id: create_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Create a dated tag for version tracking
RELEASE_TAG="v$(date +'%Y%m%d%H%M%S')"
echo "RELEASE_TAG=$RELEASE_TAG" >> $GITHUB_ENV
# Create the new release
gh release create $RELEASE_TAG \
--title "Release $RELEASE_TAG" \
--notes "This release contains the latest package zips."
# Upload the zips to the Release with consistent names
- name: Upload Zips to Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
for file in zips/*.zip; do
[ -e "$file" ] || continue
# Extract the base name without path and extension
filename=$(basename "$file")
# Upload to the versioned release
gh release upload "${{ env.RELEASE_TAG }}" "$file"
done
# Update or create the "latest" release tag
- name: Update Latest Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Delete existing latest tag and release if they exist
gh release delete latest --yes || true
git push origin :latest || true
# Create new latest release
gh release create latest \
--title "Latest Release" \
--notes "This is always the latest release. For permanent links, use the dated releases." \
--latest
# Upload files to latest release
for file in zips/*.zip; do
[ -e "$file" ] || continue
gh release upload latest "$file" --clobber
done