-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (60 loc) · 1.71 KB
/
demo.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
name: Deploy website
on:
push:
branches:
- main
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Get code
uses: actions/checkout@v3
- name: Install dependencies
run: npm ci
- name: Lint code
run: npm run lint
- name: Test code
run: npm run test
build:
needs: test
runs-on: ubuntu-latest
steps:
- name: Get code
uses: actions/checkout@v3
- name: Install dependencies
run: npm ci
- name: Build website
run: npm run build
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: dist-files
path: dist
# path: |
# dist
# package.json
deploy:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: dist-files
- name: Output contents
run: ls
- name: Deploy
run: |
echo "Deploying..."
git clone https://github:${{ env.GITHUB_TOKEN }}@github.com/sheetal-purple/another repo # clone repo to track history
mv repo/.git . # move cloned git history to root
rm -rf repo
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add --force .
git commit -m "add contents of dist-files v${{ env.SPEC_VERSION }}"
git tag -a v${{ env.SPEC_VERSION }} -m "Update v${{ env.SPEC_VERSION }}"
git push origin master --follow-tags --force
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SPEC_VERSION: 1.0.0