-
Notifications
You must be signed in to change notification settings - Fork 1
56 lines (46 loc) · 1.44 KB
/
build.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
name: Build and Release
on:
pull_request:
branches: [ "main" ]
types: ["closed"]
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
token: ${{ secrets.PAT }}
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '20.18.1'
- name: Install dependencies
run: npm install
- name: Build project
run: npm run build
- name: Get version from package.json
id: get_version
run: echo "VERSION=$(jq -r .version package.json)" >> $GITHUB_ENV
- name: Create tag
if: github.event.pull_request.merged == true
id: create_tag
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
run: |
git config --global user.name "github-actions"
git config --global user.email "github-actions@github.com"
git tag v${{ env.VERSION }}
git push https://x-access-token:${{ secrets.PAT }}@github.com/${{ github.repository }} v${{ env.VERSION }}
- name: Zip repository
run: zip -r repo.zip .
- name: Publish release
if: github.event.pull_request.merged == true
uses: softprops/action-gh-release@v1
with:
tag_name: "v${{ env.VERSION }}"
name: "Release v${{ env.VERSION }}"
files: |
repo.zip