repos / neovimcraft

website that makes it easy to find neovim plugins
git clone https://github.com/neurosnap/neovimcraft.git

commit
0755a08
parent
852d848
author
Eric Bower
date
2022-04-10 16:47:21 +0000 UTC
handle fetching and saving resources automatically using gh action (#27)

* handle fetching and saving resources automatically using gh action

* working on action
2 files changed,  +48, -2
A .github/workflows/deploy.yml
+46, -0
 1@@ -0,0 +1,46 @@
 2+name: "Fetch resources and deploy every 2 hours"
 3+on:
 4+  schedule:
 5+  - cron: "0 */2 * * *"
 6+
 7+jobs:
 8+  build:
 9+    runs-on: ubuntu-latest
10+    strategy:
11+      matrix:
12+        node-version: [16.14.0]
13+    steps:
14+    - uses: actions/checkout@v3
15+
16+    - name: use node.js ${{matrix.node-version}}
17+      uses: actions/setup-node@v1
18+      with:
19+        node-version: ${{matrix.node-version}}
20+
21+    - run: yarn
22+
23+    - run: yarn build:all
24+
25+    - name: 'gcp auth'
26+      uses: 'google-github-actions/auth@v0'
27+      with:
28+        credentials_json: ${{secrets.GCP_CREDENTIALS_JSON}}
29+
30+    - name: 'upload-folder'
31+      uses: 'google-github-actions/upload-cloud-storage@v0'
32+      with:
33+        path: './build'
34+        destination: 'neovimcraft.com'
35+        headers: |-
36+          cache-control: private, max-age=0, no-transform
37+
38+    - name: 'upload-file'
39+      uses: 'google-github-actions/upload-cloud-storage@v0'
40+      with:
41+        path: './src/lib/db.json'
42+        destination: 'neovimcraft.com/db.json'
43+        headers: |-
44+          cache-control: private, max-age=0, no-transform
45+
46+    - name: Create Pull Request
47+      uses: peter-evans/create-pull-request@v4
M package.json
+2, -2
 1@@ -20,9 +20,9 @@
 2     "upload:clean": "gsutil -m rm -r gs://neovimcraft.com/*",
 3     "upload": "gsutil -m -h 'Cache-Control:private, max-age=0, no-transform' rsync -r ./build gs://neovimcraft.com",
 4     "upload:db": "gsutil -m -h 'Cache-Control:private, max-age=0, no-transform' cp ./src/lib/db.json gs://neovimcraft.com/db.json",
 5+    "build:all": "yarn scrape && yarn patch && yarn process && yarn html && yarn build:clean && yarn build",
 6     "deploy": "yarn build:clean && yarn build && yarn upload:clean && yarn upload && yarn upload:db",
 7-    "deploy:all": "yarn scrape && yarn patch && yarn process && yarn html && yarn deploy",
 8-    "ci": "yarn scrape && yarn patch && yarn process && yarn html"
 9+    "deploy:all": "yarn scrape && yarn patch && yarn process && yarn html && yarn deploy"
10   },
11   "devDependencies": {
12     "@sveltejs/adapter-static": "^1.0.0-next.13",