hotfix: hola #301
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: soup | |
on: | |
push: | |
branches: | |
- production | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: 🗃️ Checkout | |
uses: actions/checkout@v2 | |
with: | |
submodules: recursive | |
token: ${{ secrets.CLIENT_REPO_ACCESS_TOKEN }} | |
- name: 📦️ Setup JDK 11.0.12 | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 11.0.12 | |
- name: 💾 Cache Gradle & Spring | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
restore-keys: | | |
${{ runner.os }}-gradle- | |
- name: 🔧 Build Spring server | |
working-directory: ./SouP | |
run: | | |
chmod +x ./gradlew | |
./gradlew clean build | |
- name: 📦️ Setup NodeJS 16 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
- name: 💾 Cache NPM & Next.js | |
uses: actions/cache@v3 | |
with: | |
# See here for caching with `yarn` https://github.com/actions/cache/blob/main/examples.md#node---yarn or you can leverage caching with actions/setup-node https://github.com/actions/setup-node | |
path: | | |
~/.npm | |
${{ github.workspace }}/soup-frontend/.next/cache | |
# Generate a new cache whenever packages or source files change. | |
key: ${{ runner.os }}-nextjs-${{ hashFiles('soup-frontend/**/package-lock.json') }}-${{ hashFiles('soup-frontend/**.[jt]s', 'soup-frontend/**.[jt]sx') }} | |
# If source files changed but packages didn't, rebuild from a prior cache. | |
restore-keys: | | |
${{ runner.os }}-nextjs-${{ hashFiles('soup-frontend/**/package-lock.json') }}- | |
- name: 📦️ Install NPM modules for Next.js client | |
working-directory: ./soup-frontend | |
run: | | |
npm i | |
- name: 🔧 Build Next.js client | |
working-directory: ./soup-frontend | |
run: | | |
npx next build | |
- name: 📂 Make server zip file | |
run: | | |
mkdir pre-deploy | |
cp -r deploy/server/. pre-deploy/ | |
cp SouP/build/libs/*.jar pre-deploy/ | |
zip -r deploy/soup-server.zip pre-deploy | |
rm -rf pre-deploy | |
- name: 📂 Make client zip file | |
run: | | |
mkdir pre-deploy | |
cp -r deploy/client/. pre-deploy/ | |
cp -r soup-frontend/.next/standalone/. pre-deploy | |
cp -r soup-frontend/public pre-deploy/public | |
cp -r soup-frontend/.next/static pre-deploy/.next/static | |
zip -r deploy/soup-client.zip pre-deploy | |
rm -rf pre-deploy | |
- name: 🚚 Upload to S3 | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
run: | | |
cd deploy | |
aws s3 cp --region ap-northeast-2 --acl private ./soup-server.zip s3://soup-build4/ | |
aws s3 cp --region ap-northeast-2 --acl private ./soup-client.zip s3://soup-build4/ | |
- name: 🚀 Deploy | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
run: | | |
aws deploy create-deployment \ | |
--application-name soup \ | |
--deployment-group-name soup-client \ | |
--file-exists-behavior OVERWRITE \ | |
--s3-location bucket=soup-build4,bundleType=zip,key=soup-client.zip \ | |
--region ap-northeast-2 | |
aws deploy create-deployment \ | |
--application-name soup \ | |
--deployment-group-name soup-server \ | |
--file-exists-behavior OVERWRITE \ | |
--s3-location bucket=soup-build4,bundleType=zip,key=soup-server.zip \ | |
--region ap-northeast-2 |