-
Notifications
You must be signed in to change notification settings - Fork 0
67 lines (55 loc) · 1.76 KB
/
npm-gulp.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
name: NodeJS with Gulp
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/checkout@v4
with:
node-version: '20'
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies and build
run: |
npm install
gulp
- name: Get latest tag and increment
id: version
run: |
LATEST_TAG=$(git tag --sort=-v:refname | head -n 1 || echo "1.0.0")
IFS='.' read -r -a parts <<< "$LATEST_TAG"
NEW_VERSION="${parts[0]}.${parts[1]}.$((parts[2]+1))"
if git rev-parse "refs/tags/$NEW_VERSION" >/dev/null 2>&1; then
echo "Error: Tag $NEW_VERSION already exists. Exiting."
exit 1
fi
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV
- name: Create ZIP of public folder
run: |
zip -r public.zip public
- name: Push new tag
run: |
git config --global user.name "github-actions"
git config --global user.email "[email protected]"
git tag $NEW_VERSION
git push origin $NEW_VERSION
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ env.NEW_VERSION }}
name: "v${{ env.NEW_VERSION }} Website Release"
body: "Automated release for version v${{ env.NEW_VERSION }}"
files: public.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}