-
Notifications
You must be signed in to change notification settings - Fork 14
68 lines (57 loc) · 2.26 KB
/
release-assets.yml
File metadata and controls
68 lines (57 loc) · 2.26 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
name: Create File-Friendly Release
on:
release:
types: [published]
workflow_dispatch:
jobs:
build_release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'release' && github.event.release.tag_name || github.ref }}
- name: Get Tag Name or Ref for Archives
id: get_ref_name
run: |
if [ "${{ github.event_name }}" == "release" ]; then
echo "REF_FOR_ARCHIVE=${{ github.event.release.tag_name }}" >> $GITHUB_ENV
else
RAW_REF_NAME=$(echo "${{ github.ref }}" | sed -e 's|refs/heads/||' -e 's|refs/tags/||')
SANITIZED_REF_NAME=$(echo "${RAW_REF_NAME}" | sed 's/[^a-zA-Z0-9._-]/-/g')
echo "REF_FOR_ARCHIVE=${SANITIZED_REF_NAME:-manual-run}" >> $GITHUB_ENV
fi
env:
REF_FOR_ARCHIVE: ''
- name: Define Base Archive Name
id: set_base_name
run: |
echo "ARCHIVE_BASE_NAME=Task-Checklist-${{ env.REF_FOR_ARCHIVE }}" >> $GITHUB_OUTPUT
echo "Using archive base name: Task-Checklist-${{ env.REF_FOR_ARCHIVE }}"
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'
- name: Install dependencies
run: npm install
- name: Build project with Vite
run: npm run build-release
- name: Rename Release File
run: |
cd ./release
mv index.html ${{ steps.set_base_name.outputs.ARCHIVE_BASE_NAME }}.html
- name: Upload Release with gh CLI
if: github.event_name == 'release' && github.event.release.tag_name
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload "${{ github.event.release.tag_name }}" "./release/${{ steps.set_base_name.outputs.ARCHIVE_BASE_NAME }}.html" --clobber
- name: Upload Source Directory as Artifact (for manual/dispatch runs)
if: github.event_name == 'workflow_dispatch'
uses: actions/upload-artifact@v4
with:
name: ${{ steps.set_base_name.outputs.ARCHIVE_BASE_NAME }}
path: ./release/${{ steps.set_base_name.outputs.ARCHIVE_BASE_NAME }}.html