-
Notifications
You must be signed in to change notification settings - Fork 2
72 lines (61 loc) · 1.96 KB
/
Copy pathrelease.yml
File metadata and controls
72 lines (61 loc) · 1.96 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
name: Create GitHub release
on:
push:
tags:
- "*"
permissions:
contents: write
jobs:
release:
name: Release tagged main commit
runs-on: ubuntu-latest
steps:
- name: Check out repository history
uses: actions/checkout@v5
with:
fetch-depth: 0
lfs: true
- name: Check whether the tag is on main
id: tag-check
env:
TAG_NAME: ${{ github.ref_name }}
shell: bash
run: |
git fetch --no-tags origin main
tag_commit="$(git rev-list -n 1 "$TAG_NAME")"
if git merge-base --is-ancestor "$tag_commit" origin/main; then
echo "on_mainline=true" >> "$GITHUB_OUTPUT"
else
echo "on_mainline=false" >> "$GITHUB_OUTPUT"
echo "Tag $TAG_NAME does not point to a commit on main; skipping release."
fi
- name: Set up Java 17
if: steps.tag-check.outputs.on_mainline == 'true'
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: "17"
cache: gradle
- name: Set up Node.js
if: steps.tag-check.outputs.on_mainline == 'true'
uses: actions/setup-node@v6
with:
node-version: "22"
cache: npm
cache-dependency-path: extension_host/package-lock.json
- name: Build release extension
if: steps.tag-check.outputs.on_mainline == 'true'
run: ./scripts/build.sh --mode release --clean
- name: Create GitHub release
if: steps.tag-check.outputs.on_mainline == 'true'
env:
GH_TOKEN: ${{ github.token }}
TAG_NAME: ${{ github.ref_name }}
run: |
if ! gh release view "$TAG_NAME" >/dev/null 2>&1; then
gh release create "$TAG_NAME" \
--verify-tag \
--generate-notes \
--title "$TAG_NAME"
fi
gh release upload "$TAG_NAME" dist/ZooCode-*.zip --clobber