forked from ts-defold/types
-
Notifications
You must be signed in to change notification settings - Fork 0
72 lines (65 loc) · 2.24 KB
/
release.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
name: Check Version and Release
on:
schedule:
- cron: '0 0 * * 1,3,5'
workflow_dispatch:
jobs:
check_and_release:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Set Up Node.js
uses: actions/setup-node@v4
with:
node-version: 'lts/*'
cache: 'yarn'
- name: Get Version from JSON
run: |
DEFOLD_VERSION=$(curl -s https://d.defold.com/stable/info.json | jq -r .version)
PACKAGE_VERSION=$(node -p "require('./package.json').version")
echo "DEFOLD_VERSION=${DEFOLD_VERSION}" >> $GITHUB_ENV
echo "PACKAGE_VERSION=${PACKAGE_VERSION}" >> $GITHUB_ENV
- name: Bump Version
run: |
if [ "${DEFOLD_VERSION}" == "${PACKAGE_VERSION}" ]; then
echo "${DEFOLD_VERSION} already exists. Skipping bump version."
exit 0
else
# Bump Version
git config user.email "actions@github.com"
git config user.name "GitHub Actions"
npm --no-git-tag-version version ${DEFOLD_VERSION}
git add --all
git commit -m "chore: bump version to ${DEFOLD_VERSION}"
git push
fi
- name: Build
continue-on-error: true
run: |
if [ "${DEFOLD_VERSION}" == "${PACKAGE_VERSION}" ]; then
echo "${DEFOLD_VERSION} already exists. Skipping build."
exit 0
else
# Build
yarn
yarn run build
git add --all
git commit -m "feat: build for Defold stable ${DEFOLD_VERSION}"
git push
fi
- name: Publish Tag and Release
env:
GH_TOKEN: ${{ github.token }}
run: |
if [ "${DEFOLD_VERSION}" == "${PACKAGE_VERSION}" ]; then
echo "${DEFOLD_VERSION} already exists. Skipping publish."
exit 0
else
# Create Tag
GITHUB_VERSION="v${DEFOLD_VERSION}"
git tag ${GITHUB_VERSION}
git push origin ${GITHUB_VERSION}
# Create Release
gh release create ${GITHUB_VERSION} -t "${GITHUB_VERSION}" -n "Release for Defold ${GITHUB_VERSION}"
fi