-
Notifications
You must be signed in to change notification settings - Fork 2
93 lines (90 loc) · 2.81 KB
/
main.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
name: CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
Setup:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Bundled Node Version
run: |
echo "Node version: $(which node):$(node -v)"
echo "NPM version: $(which npm):$(npm -v)"
- uses: volta-cli/action@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Install PNPM
run: volta install pnpm
- name: Project Node Version
run: |
echo "Node version: $(which node):$(node -v)"
echo "NPM version: $(which npm):$(npm -v)"
echo "PNPM version: $(which pnpm):$(pnpm -v)"
Build:
needs: [Setup]
if: "!contains(github.event.head_commit.message, '[skip ci]')"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: volta-cli/action@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/cache@v4
with:
path: ~/.pnpm-store
key: pnpm-install-v3-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
pnpm-install-v3-
- name: Install PNPM
run: volta install pnpm
- name: Install Dependencies
run: pnpm install
- name: Lint
run: pnpm lint
- name: Build
run: pnpm build
- if: github.event_name == 'push'
uses: actions/upload-artifact@v4
with:
name: build-art
path: dist
Deploy:
needs: [Build]
if: github.event_name == 'push'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
repository: awesomehub/awesomehub.github.io
token: ${{ secrets.PAT }}
path: deploy
- run: rm -r deploy/dist/*
- uses: actions/download-artifact@v4
id: download
with:
name: build-art
path: deploy/dist
- uses: peter-evans/create-pull-request@v3
with:
branch: staging
path: deploy
token: ${{ secrets.PAT }}
commit-message: ${{ github.event.head_commit.message }} ${{ github.event.head_commit.url }}
title: ${{ github.event.head_commit.message }}
body: |
## Build Information
- ### Action
${{ github.workflow }} [#${{ github.run_number }}](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})
- ### Commit
${{ github.event.head_commit.message }} ${{ github.event.head_commit.url }}
- ### Author
@${{ github.actor }}
---
> :rocket: *This report is autogenerated, any changes made will be overwrittten with the next commit.*
labels: |
deploy
automated
assignees: ${{ github.actor }}