-
Notifications
You must be signed in to change notification settings - Fork 83
88 lines (77 loc) · 2.47 KB
/
upload.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
name: Deploy PWA
on:
release:
types: [published]
push:
branches: [main]
workflow_dispatch:
inputs:
environment:
description: 'The environment to deploy to'
type: choice
required: true
default: 'staging'
options:
- staging
- production
tag-version:
description: 'The tag version, branch name or SHA to checkout'
required: true
permissions:
contents: read
packages: read
jobs:
build-and-upload:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
ref: ${{ inputs.tag-version || github.ref }}
- name: Setup Node and Yarn
uses: ./.github/actions/setup
with:
npm-auth-token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup environment
run: |
touch apps/web/.env
cat <<EOT >> apps/web/.env
API_URL=${{ vars.API_URL }}
API_SECURITY_TOKEN=${{ secrets.API_SECURITY_TOKEN }}
${{ vars.CONFIG }}
EOT
- name: Build
run: yarn build
- name: Install productive dependencies for server
run: yarn workspaces focus --production
- name: Copy Middleware Server
run: |
mkdir middleware
cp -r node_modules middleware
cp -r apps/server middleware
- name: Compress repo to Tar
uses: a7ul/[email protected]
id: compress
with:
command: c
cwd: ./
files: |
./apps/web/.output
./middleware
outPath: pwa.tar.gz
- name: Upload build to production
if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && github.event.inputs.environment == 'production')
id: upload-production
uses: JantHsueh/[email protected]
with:
url: 'https://pwapublish.plentysystems.com'
forms: '{ "token": "${{ secrets.URL_ENDPOINT_TOKEN }}" }'
fileForms: '{ "file": "pwa.tar.gz" }'
- name: Upload build to staging
if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.environment == 'staging')
id: upload-staging
uses: JantHsueh/[email protected]
with:
url: 'https://pwapublish.plentysystems.com'
forms: '{ "token": "${{ secrets.URL_ENDPOINT_TOKEN_STAGING }}" }'
fileForms: '{ "file": "pwa.tar.gz" }'