Ken-Miura is starting workflow #14
Workflow file for this run
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: Test, build and upload artifacts | |
run-name: ${{ github.actor }} is starting workflow | |
on: | |
workflow_dispatch | |
jobs: | |
# Github Actionsの無料枠を使い切った場合を考慮し、ローカルでも実行できるようにコマンドをメインにジョブを作成する | |
Test-Build-And-Upload-Artifacts: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v3 | |
- name: Test and build server side code | |
run: | | |
docker build --build-arg UID="`id -u`" --build-arg GID="`id -g`" --target development -t development -f .devcontainer/Dockerfile server/ | |
docker build --target server-test-and-build -t server-test-and-build -f .devcontainer/Dockerfile server/ | |
- name: Create images | |
run: | | |
docker build --target user-service -t ccs-user-service:"$(git rev-parse HEAD)" -f .devcontainer/Dockerfile server/ | |
docker build --target admin-service -t ccs-admin-service:"$(git rev-parse HEAD)" -f .devcontainer/Dockerfile server/ | |
docker build --target admin-account -t ccs-admin-account:"$(git rev-parse HEAD)" -f .devcontainer/Dockerfile server/ | |
docker build --target delete-expired-consultation-reqs -t ccs-delete-expired-consultation-reqs:"$(git rev-parse HEAD)" -f .devcontainer/Dockerfile server/ | |
docker build --target delete-expired-deleted-user-accounts -t ccs-delete-expired-deleted-user-accounts:"$(git rev-parse HEAD)" -f .devcontainer/Dockerfile server/ | |
docker build --target delete-expired-pwd-change-reqs -t ccs-delete-expired-pwd-change-reqs:"$(git rev-parse HEAD)" -f .devcontainer/Dockerfile server/ | |
docker build --target delete-expired-temp-accounts -t ccs-delete-expired-temp-accounts:"$(git rev-parse HEAD)" -f .devcontainer/Dockerfile server/ | |
docker build --target delete-expired-temp-mfa-secrets -t ccs-delete-expired-temp-mfa-secrets:"$(git rev-parse HEAD)" -f .devcontainer/Dockerfile server/ | |
docker build --target db-initializer -t ccs-db-initializer:"$(git rev-parse HEAD)" -f .devcontainer/Dockerfile server/ | |
docker build --target migration-tool -t ccs-migration-tool:"$(git rev-parse HEAD)" -f .devcontainer/Dockerfile server/ | |
docker build --target index-initializer -t ccs-index-initializer:"$(git rev-parse HEAD)" -f .devcontainer/Dockerfile server/ | |
- name: Test and build client side code | |
run: > | |
docker run -v "$(pwd)/client":/home/developer/workspace | |
-e VUE_APP_BUSINESS_OPERATOR_NAME=${BUSINESS_OPERATOR_NAME} | |
-e VUE_APP_BUSINESS_OPERATOR_ZIP_CODE=${BUSINESS_OPERATOR_ZIP_CODE} | |
-e VUE_APP_BUSINESS_OPERATOR_ADDRESS=${BUSINESS_OPERATOR_ADDRESS} | |
-e VUE_APP_BUSINESS_OPERATOR_INQUIRY_EMAIL_ADDRESS=${BUSINESS_OPERATOR_INQUIRY_EMAIL_ADDRESS} | |
-e VUE_APP_TRANSFER_FEE_IN_YEN=${TRANSFER_FEE_IN_YEN} | |
-e VUE_APP_PLATFORM_FEE_RATE_IN_PERCENTAGE=${PLATFORM_FEE_RATE_IN_PERCENTAGE} | |
-e VUE_APP_WAITING_PERIOD_BEFORE_WITHDRAWAL_TO_CONSULTANT_IN_DAYS=${WAITING_PERIOD_BEFORE_WITHDRAWAL_TO_CONSULTANT_IN_DAYS} | |
development bash -c 'source ${NVM_DIR}/nvm.sh | |
&& pushd user_app && npm i && npm run lint && npm run test:unit && npm run build && popd | |
&& pushd admin_app && npm i && npm run lint && npm run test:unit && npm run build' | |
env: | |
BUSINESS_OPERATOR_NAME: ${{ vars.BUSINESS_OPERATOR_NAME }} | |
BUSINESS_OPERATOR_ZIP_CODE: ${{ vars.BUSINESS_OPERATOR_ZIP_CODE }} | |
BUSINESS_OPERATOR_ADDRESS: ${{ vars.BUSINESS_OPERATOR_ADDRESS }} | |
BUSINESS_OPERATOR_INQUIRY_EMAIL_ADDRESS: ${{ vars.BUSINESS_OPERATOR_INQUIRY_EMAIL_ADDRESS }} | |
TRANSFER_FEE_IN_YEN: ${{ vars.TRANSFER_FEE_IN_YEN }} | |
PLATFORM_FEE_RATE_IN_PERCENTAGE: ${{ vars.PLATFORM_FEE_RATE_IN_PERCENTAGE }} | |
WAITING_PERIOD_BEFORE_WITHDRAWAL_TO_CONSULTANT_IN_DAYS: ${{ vars.WAITING_PERIOD_BEFORE_WITHDRAWAL_TO_CONSULTANT_IN_DAYS }} | |
- name: Upload images | |
run: | | |
aws ecr get-login-password --region ${AWS_DEFAULT_REGION} | docker login --username AWS --password-stdin ${AWS_ECR_ACCOUNT} | |
docker tag ccs-user-service:"$(git rev-parse HEAD)" ${AWS_ECR_ACCOUNT}/ccs-user-service:"$(git rev-parse HEAD)" | |
docker push ${AWS_ECR_ACCOUNT}/ccs-user-service:"$(git rev-parse HEAD)" | |
docker tag ccs-admin-service:"$(git rev-parse HEAD)" ${AWS_ECR_ACCOUNT}/ccs-admin-service:"$(git rev-parse HEAD)" | |
docker push ${AWS_ECR_ACCOUNT}/ccs-admin-service:"$(git rev-parse HEAD)" | |
docker tag ccs-admin-account:"$(git rev-parse HEAD)" ${AWS_ECR_ACCOUNT}/ccs-admin-account:"$(git rev-parse HEAD)" | |
docker push ${AWS_ECR_ACCOUNT}/ccs-admin-account:"$(git rev-parse HEAD)" | |
docker tag ccs-delete-expired-consultation-reqs:"$(git rev-parse HEAD)" ${AWS_ECR_ACCOUNT}/ccs-delete-expired-consultation-reqs:"$(git rev-parse HEAD)" | |
docker push ${AWS_ECR_ACCOUNT}/ccs-delete-expired-consultation-reqs:"$(git rev-parse HEAD)" | |
docker tag ccs-delete-expired-deleted-user-accounts:"$(git rev-parse HEAD)" ${AWS_ECR_ACCOUNT}/ccs-delete-expired-deleted-user-accounts:"$(git rev-parse HEAD)" | |
docker push ${AWS_ECR_ACCOUNT}/ccs-delete-expired-deleted-user-accounts:"$(git rev-parse HEAD)" | |
docker tag ccs-delete-expired-pwd-change-reqs:"$(git rev-parse HEAD)" ${AWS_ECR_ACCOUNT}/ccs-delete-expired-pwd-change-reqs:"$(git rev-parse HEAD)" | |
docker push ${AWS_ECR_ACCOUNT}/ccs-delete-expired-pwd-change-reqs:"$(git rev-parse HEAD)" | |
docker tag ccs-delete-expired-temp-accounts:"$(git rev-parse HEAD)" ${AWS_ECR_ACCOUNT}/ccs-delete-expired-temp-accounts:"$(git rev-parse HEAD)" | |
docker push ${AWS_ECR_ACCOUNT}/ccs-delete-expired-temp-accounts:"$(git rev-parse HEAD)" | |
docker tag ccs-delete-expired-temp-mfa-secrets:"$(git rev-parse HEAD)" ${AWS_ECR_ACCOUNT}/ccs-delete-expired-temp-mfa-secrets:"$(git rev-parse HEAD)" | |
docker push ${AWS_ECR_ACCOUNT}/ccs-delete-expired-temp-mfa-secrets:"$(git rev-parse HEAD)" | |
docker tag ccs-db-initializer:"$(git rev-parse HEAD)" ${AWS_ECR_ACCOUNT}/ccs-db-initializer:"$(git rev-parse HEAD)" | |
docker push ${AWS_ECR_ACCOUNT}/ccs-db-initializer:"$(git rev-parse HEAD)" | |
docker tag ccs-migration-tool:"$(git rev-parse HEAD)" ${AWS_ECR_ACCOUNT}/ccs-migration-tool:"$(git rev-parse HEAD)" | |
docker push ${AWS_ECR_ACCOUNT}/ccs-migration-tool:"$(git rev-parse HEAD)" | |
docker tag ccs-index-initializer:"$(git rev-parse HEAD)" ${AWS_ECR_ACCOUNT}/ccs-index-initializer:"$(git rev-parse HEAD)" | |
docker push ${AWS_ECR_ACCOUNT}/ccs-index-initializer:"$(git rev-parse HEAD)" | |
env: | |
AWS_ECR_ACCOUNT: ${{ vars.AWS_ECR_ACCOUNT }} | |
AWS_DEFAULT_REGION: ${{ vars.AWS_DEFAULT_REGION }} | |
AWS_DEFAULT_OUTPUT: json | |
AWS_ACCESS_KEY_ID: ${{ secrets.ARTIFACTS_UPLOADER_AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.ARTIFACTS_UPLOADER_AWS_SECRET_ACCESS_KEY }} | |
# (意図しないリリースを避けるため、) ユーザーからアクセスされるS3バケットへ直接アップロードするのではなく、まず別のバケットへアップロードする | |
- name: Upload static files | |
run: | | |
aws s3 sync client/user_app/dist s3://${CCS_USER_APP_RELEASE_PREPARATION_S3_BUCKET} --delete --exclude '*.js.map' | |
aws s3 sync client/admin_app/dist s3://${CCS_ADMIN_APP_RELEASE_PREPARATION_S3_BUCKET} --delete --exclude '*.js.map' | |
env: | |
CCS_USER_APP_RELEASE_PREPARATION_S3_BUCKET: ${{ vars.CCS_USER_APP_RELEASE_PREPARATION_S3_BUCKET }} | |
CCS_ADMIN_APP_RELEASE_PREPARATION_S3_BUCKET: ${{ vars.CCS_ADMIN_APP_RELEASE_PREPARATION_S3_BUCKET }} | |
AWS_DEFAULT_REGION: ${{ vars.AWS_DEFAULT_REGION }} | |
AWS_DEFAULT_OUTPUT: json | |
AWS_ACCESS_KEY_ID: ${{ secrets.ARTIFACTS_UPLOADER_AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.ARTIFACTS_UPLOADER_AWS_SECRET_ACCESS_KEY }} |