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 ce29f0e
Show file tree
Hide file tree
Showing 8 changed files with 9,649 additions and 6,985 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
34 changes: 34 additions & 0 deletions .github/actions/deploy/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Deploy
description: Deploy

inputs:
aws_access_key_id:
description: AWS_ACCESS_KEY_ID
required: true
aws_secret_access_key:
description: AWS_SECRET_ACCESS_KEY
required: true
aws_region:
description: AWS_REGION
required: true
bucket_name:
description: AWS_REGION
required: true

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: ${{ inputs.bucket_name }}
AWS_ACCESS_KEY_ID: ${{ inputs.aws_access_key_id }}
AWS_SECRET_ACCESS_KEY: ${{ inputs.aws_secret_access_key }}
AWS_REGION: ${{ inputs.aws_region }}
SOURCE_DIR: "vue/dist"
26 changes: 26 additions & 0 deletions .github/workflows/deploy-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
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
with:
aws_account_id: ${{ secrets.AWS_ACCOUNT_ID }}
aws_region: "us-east-1"
bucket_name: ${{ secrets.ASTRONOMY_API_DEMO_AWS_S3_BUCKET }}
55 changes: 13 additions & 42 deletions .github/workflows/deploy-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,55 +2,26 @@ name: Deploy

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
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
with:
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws_region: "us-east-1"
bucket_name: ${{ secrets.ASTRONOMY_API_DEMO_AWS_S3_BUCKET }}
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 ce29f0e

Please sign in to comment.