-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* temp: build * test * fix dir * revert test changes
- Loading branch information
Showing
4 changed files
with
52 additions
and
34 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,8 +22,42 @@ jobs: | |
contents: read | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- run: docker build -t animeta-frontend . | ||
|
||
# Build | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
|
||
- uses: pnpm/[email protected] | ||
name: Install pnpm | ||
id: pnpm-install | ||
with: | ||
version: 7 | ||
run_install: false | ||
|
||
- name: Get pnpm store directory | ||
id: pnpm-cache | ||
run: | | ||
echo "::set-output name=pnpm_cache_dir::$(pnpm store path)" | ||
- uses: actions/cache@v3 | ||
name: Setup pnpm cache | ||
with: | ||
path: ${{ steps.pnpm-cache.outputs.pnpm_cache_dir }} | ||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
restore-keys: | | ||
${{ runner.os }}-pnpm-store- | ||
- name: Install dependencies | ||
run: pnpm install --frozen-lockfile | ||
|
||
- run: pnpm -C frontend-server run build:bundle | ||
- run: pnpm -C frontend run build-assets | ||
- run: pnpm -C frontend run build-server | ||
|
||
# Deploy | ||
- name: Set up gcloud | ||
|
@@ -33,25 +67,15 @@ jobs: | |
version: '270.0.0' | ||
service_account_email: ${{ secrets.GCP_SA_EMAIL }} | ||
service_account_key: ${{ secrets.GCP_SA_KEY }} | ||
- name: Extract assets | ||
if: github.event_name == 'push' && github.ref == 'refs/heads/master' | ||
run: | | ||
mkdir /tmp/extract-static | ||
docker run -v /tmp/extract-static:/workspace --entrypoint /bin/bash animeta-frontend -c "cp -r /app/frontend/dist/static /workspace/" | ||
- name: Upload assets | ||
if: github.event_name == 'push' && github.ref == 'refs/heads/master' | ||
run: gsutil -m cp -z js,css,map -r /tmp/extract-static/static gs://animeta-static/ | ||
- name: Docker push | ||
if: github.event_name == 'push' && github.ref == 'refs/heads/master' | ||
run: | | ||
gcloud auth configure-docker | ||
docker tag animeta-frontend gcr.io/ditto-1470749749381/animeta-frontend:latest | ||
docker push gcr.io/ditto-1470749749381/animeta-frontend:latest | ||
run: gsutil -m cp -z js,css,map -r frontend/dist/static gs://animeta-static/ | ||
- name: Configure AWS Credentials | ||
if: github.event_name == 'push' && github.ref == 'refs/heads/master' | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
with: | ||
aws-region: ap-northeast-2 | ||
role-to-assume: arn:aws:iam::307761743095:role/animeta-deploy-github-actions-Role-19IZBY3F8TXQ | ||
- name: Deploy lambda | ||
if: github.event_name == 'push' && github.ref == 'refs/heads/master' | ||
run: ./deploy/lambda/build.sh && ./deploy/lambda/deploy.sh | ||
run: ./deploy/lambda/package.sh && ./deploy/lambda/deploy.sh |
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
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
rm -rf deploy/lambda/dist | ||
mkdir -p deploy/lambda/dist/app/{frontend-server,frontend} | ||
|
||
cp -r frontend-server/dist deploy/lambda/dist/app/frontend-server/ | ||
cp -r frontend/dist deploy/lambda/dist/app/frontend/ | ||
|
||
echo ANIMETA_FRONTEND_DIST_PATH=app/frontend/dist >> deploy/lambda/dist/.env | ||
|
||
cd deploy/lambda/dist | ||
zip --symlinks -r package.zip app .env |