-
Notifications
You must be signed in to change notification settings - Fork 16
87 lines (74 loc) · 2.79 KB
/
release.yml
File metadata and controls
87 lines (74 loc) · 2.79 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
name: Release
on:
release:
types: [published]
workflow_dispatch:
inputs:
tag:
description: 'Release tag (e.g., 6.6.6)'
required: true
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Set version
id: version
run: |
if [ "${{ github.event_name }}" == "release" ]; then
VERSION=${{ github.event.release.tag_name }}
elif [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
VERSION=${{ github.event.inputs.tag }}
fi
# Remove 'v' prefix if present
VERSION=${VERSION#v}
echo "version=${VERSION}" >> $GITHUB_OUTPUT
- name: Download release archive
id: archive
run: |
VERSION=${{ steps.version.outputs.version }}
ARCHIVE_NAME="n-able-Arduino-${VERSION}.tar.gz"
ARCHIVE_URL="https://github.com/${{ github.repository }}/archive/refs/tags/${VERSION}.tar.gz"
echo "Downloading archive from: ${ARCHIVE_URL}"
curl -sL -o "${ARCHIVE_NAME}" "${ARCHIVE_URL}"
if [ ! -f "${ARCHIVE_NAME}" ]; then
echo "Failed to download archive!"
exit 1
fi
# Calculate checksum and size
echo "Archive downloaded:"
ls -lh "${ARCHIVE_NAME}"
CHECKSUM=$(sha256sum "${ARCHIVE_NAME}" | cut -d ' ' -f 1)
SIZE=$(stat -c%s "${ARCHIVE_NAME}")
echo "archive_name=${ARCHIVE_NAME}" >> $GITHUB_OUTPUT
echo "checksum=${CHECKSUM}" >> $GITHUB_OUTPUT
echo "size=${SIZE}" >> $GITHUB_OUTPUT
- name: Checkout gh-pages
uses: actions/checkout@v6
with:
ref: gh-pages
path: gh-pages
- name: Update package index
id: update-index
env:
VERSION: ${{ steps.version.outputs.version }}
ARCHIVE_NAME: ${{ steps.archive.outputs.archive_name }}
CHECKSUM: ${{ steps.archive.outputs.checksum }}
SIZE: ${{ steps.archive.outputs.size }}
run: |
cd gh-pages
python ../.github/scripts/update_package_index.py
- name: Commit and push to gh-pages
working-directory: gh-pages
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config user.name "github-actions"
git config user.email "github-actions@github.com"
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}.git
git add package_n-able_boards_index.json
git commit -m "Update package index for v${{ steps.version.outputs.version }}" || echo "No changes to commit"
git push origin gh-pages