-
Notifications
You must be signed in to change notification settings - Fork 57
104 lines (97 loc) · 2.67 KB
/
stage-pipeline.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
94
95
96
97
98
99
100
101
102
103
104
---
name: Develop Staging Pipeline
on:
workflow_dispatch:
push:
branches:
- develop
jobs:
build:
name: Build for Staging
environment: Development
runs-on: ubuntu-latest
steps:
# Checkout code
- name: Checkout Code
uses: actions/checkout@v4
# Setup Node
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
# Get Node Modules from Cache
- name: Cache node modules
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
path: ~/.npm
key: ${{ runner.os }}-build- ${{ env.cache-name }}-
${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
# Ensure Node Modules Setup
- name: Install Dependencies
run: npm ci --ignore-scripts
# Build
- name: Build
run: npm run build
# Save Artifacts
- name: Upload Artifacts
uses: actions/[email protected]
with:
name: build
path: dist
development:
name: Deploy to GitHub Pages
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v4
- name: Install and Build 🔧
run: |
npm ci
npm run build
# Deploy to GitHub Pages
- name: Deploy 🚀
uses: JamesIves/[email protected]
with:
# The branch the action should deploy to.
branch: gh-pages
# The folder the action should deploy.
folder: dist
# Automatically remove deleted files from the deploy branch
clean: true
staging:
needs: build
environment: Development
name: Deploy to dev.keeptrack.space
runs-on: ubuntu-latest
steps:
# Download Artifacts
- name: Download Artifacts
uses: actions/[email protected]
with:
name: build
path: dist
# Deploy
- name: Deploy files via SFTP
uses: pressidium/lftp-mirror-action@v1
with:
# SFTP credentials
host: ${{ secrets.FTP_HOST }}
port: 22
user: ${{ secrets.FTP_USERNAME }}
pass: ${{ secrets.FTP_PASSWORD }}
# lftp settings
onlyNewer: true
settings: 'sftp:auto-confirm=yes'
# Mirror command options
localDir: './dist/'
remoteDir: ${{ secrets.FTP_REMOTE_FOLDER }}
reverse: true
ignoreFile: './dist/.lftp_ignore'
options: '--verbose'