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 33816d1
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 39 deletions.
31 changes: 31 additions & 0 deletions .github/actions/build/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Build
description: Build

runs:
using: composite
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install dependencies
run: npm i
shell: |
cd vue
npm i -g yarn
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
22 changes: 22 additions & 0 deletions .github/actions/deploy/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Deploy
description: Deploy

runs:
using: composite
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'
19 changes: 19 additions & 0 deletions .github/workflows/deploy-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Deploy

on:
push:
branches: [ "dev" ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: ./.github/actions/build

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

- uses: ./.github/actions/deploy
41 changes: 2 additions & 39 deletions .github/workflows/deploy-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,54 +3,17 @@ 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: ./.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: ./.github/actions/deploy

0 comments on commit 33816d1

Please sign in to comment.