Skip to content

Commit

Permalink
update workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
astroanu committed Apr 4, 2024
1 parent 5cf6836 commit a1a4ed3
Show file tree
Hide file tree
Showing 8 changed files with 9,625 additions and 6,984 deletions.
27 changes: 27 additions & 0 deletions .github/actions/build/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Build
description: Build

runs:
using: composite
steps:
- name: Install dependencies
shell: bash
run: |
cd vue
yarn install
yarn build
- name: Build
run: |
if expr "${{ inputs.target }}" : "Dev" >/dev/null; then
npm run build;
fi
if expr "${{ inputs.target }}" : "Prod" >/dev/null; then
npm run build:prod;
fi
shell: bash

- uses: actions/upload-artifact@master
with:
name: buid-artifact
path: vue/dist
20 changes: 20 additions & 0 deletions .github/actions/deploy/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Deploy
description: Deploy

runs:
using: composite
steps:
- uses: actions/download-artifact@master
with:
name: buid-artifact
path: vue/dist

- uses: jakejarvis/s3-sync-action@master
with:
args: --acl public-read --follow-symlinks --delete
env:
AWS_S3_BUCKET: ${{ secrets.ASTRONOMY_API_DEMO_AWS_S3_BUCKET }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: 'us-east-1'
SOURCE_DIR: 'vue/dist'
22 changes: 22 additions & 0 deletions .github/workflows/deploy-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Deploy

on:
push:
branches: ["dev"]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@v4
with:
node-version: 20
- uses: actions/checkout@v4
- uses: ./.github/actions/build

deploy:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/deploy
48 changes: 7 additions & 41 deletions .github/workflows/deploy-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,54 +3,20 @@ name: Deploy
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]

steps:
- uses: actions/checkout@v3

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- name: Build
run: |
cd vue
npm i -g yarn
yarn install
yarn build
- uses: actions/upload-artifact@master
with:
name: buid-artifact
path: vue/dist
- uses: actions/setup-node@v4
with:
node-version: 20
- uses: actions/checkout@v4
- uses: ./.github/actions/build

deploy:
needs: build
runs-on: ubuntu-latest
steps:

- uses: actions/checkout@master

- uses: actions/download-artifact@master
with:
name: buid-artifact
path: vue/dist

- uses: jakejarvis/s3-sync-action@master
with:
args: --acl public-read --follow-symlinks --delete
env:
AWS_S3_BUCKET: ${{ secrets.ASTRONOMY_API_DEMO_AWS_S3_BUCKET }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: 'us-east-1'
SOURCE_DIR: 'vue/dist'
- uses: actions/checkout@v4
- uses: ./.github/actions/deploy
3 changes: 2 additions & 1 deletion vue/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules
dist
.DS_STORE
.DS_STORE
.yarn
1 change: 1 addition & 0 deletions vue/.yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodeLinker: node-modules
2 changes: 1 addition & 1 deletion vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"main": "index.js",
"scripts": {
"watch": "node_modules/.bin/webpack-dev-server",
"build": "webpack",
"build": "NODE_OPTIONS=--openssl-legacy-provider webpack",
"prettier": "npx prettier --write ./js/**/*"
},
"author": "",
Expand Down
Loading

0 comments on commit a1a4ed3

Please sign in to comment.