forked from rokucommunity/brighterscript
-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (62 loc) · 2.25 KB
/
xelp_shadow_release.yml
File metadata and controls
77 lines (62 loc) · 2.25 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
name: Xelp Shadow Release
on:
workflow_dispatch:
jobs:
shadow-release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout xelp/main
uses: actions/checkout@v4
with:
ref: xelp/main
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
- name: Configure Git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Calculate XelpShadow Version
id: version
run: |
CURRENT_VERSION=$(node -p "require('./package.json').version")
echo "Current version: $CURRENT_VERSION"
# Remove pre-release and build metadata
BASE_VERSION=$(echo "$CURRENT_VERSION" | sed 's/[-+].*//')
# Split version into parts
IFS='.' read -r -a PARTS <<< "$BASE_VERSION"
if [ ${#PARTS[@]} -ne 3 ]; then
echo "Error: Version must be in MAJOR.MINOR.PATCH format"
exit 1
fi
MAJOR="${PARTS[0]}"
MINOR="${PARTS[1]}"
PATCH="${PARTS[2]}"
# Add 100 to major version
NEW_MAJOR=$((MAJOR + 100))
# Get build metadata
DATE=$(date +'%Y%m%d')
SHORT_HASH=$(git rev-parse --short HEAD)
SHADOW_VERSION="$NEW_MAJOR.$MINOR.$PATCH-xelp-$DATE-$SHORT_HASH"
echo "Shadow version: $SHADOW_VERSION"
echo "shadow_version=$SHADOW_VERSION" >> $GITHUB_OUTPUT
- name: Install dependencies
run: npm ci
- name: Update package.json version
run: |
npm version ${{ steps.version.outputs.shadow_version }} --no-git-tag-version --ignore-scripts
- name: Build
run: npm run build
- name: Commit and Push
run: |
set -e
git checkout -b xelp/dist
git add -f dist/ package.json package-lock.json
git commit -m "Release shadow version ${{ steps.version.outputs.shadow_version }}"
git tag "v${{ steps.version.outputs.shadow_version }}"
git push origin xelp/dist --force
git push origin "v${{ steps.version.outputs.shadow_version }}"