Update README.md #123
This file contains hidden or 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 workflow will do a clean install of node dependencies, cache/restore them, build the source code and run tests across different versions of node | |
| # For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions | |
| name: deploy | |
| on: | |
| push: | |
| branches: | |
| - develop | |
| jobs: | |
| build: | |
| runs-on: ubuntu-20.04 | |
| strategy: | |
| matrix: | |
| node-version: [22.13.0] | |
| # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ | |
| steps: | |
| - name: Checkout source code. | |
| uses: actions/checkout@v2 | |
| - name: Use Node.js ${{ matrix.node-version }} | |
| uses: actions/setup-node@v2 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| - name: Check Npm -v | |
| run: npm -v | |
| - name: Debug secrets.ENV | |
| run: | | |
| if [[ -z "${{ secrets.ENV }}" ]]; then | |
| echo "ERROR: secrets.ENV is empty!" | |
| exit 1 | |
| else | |
| echo "secrets.ENV is set but value is hidden for security reasons.." | |
| fi | |
| - name: create env file | |
| working-directory: ./ | |
| run: | | |
| pwd | |
| touch .env | |
| echo ENV=${{ secrets.ENV }} > .env | |
| cat .env | |
| # - name: create env file | |
| # working-directory: ./ | |
| # run: | | |
| # pwd | |
| # touch .env | |
| # echo "ENV=test_value" > .env | |
| # cat .env | |
| # - name: Verify .env file size | |
| # run: | | |
| # if [ ! -s .env ]; then | |
| # echo ".env file is empty or does not exist." | |
| # exit 1 | |
| # else | |
| # echo ".env file created successfully:" | |
| # cat .env | |
| # fi | |
| - name: build server files | |
| working-directory: ./ | |
| run: | | |
| pwd | |
| yarn | |
| yarn run build | |
| ###################################### 추가된 부분 ###################################### | |
| - name: zip file | |
| run: zip -r artne.zip ./scripts ./appspec.yml ./.env ./package.json index.js ./config ./src ./middlewares | |
| - name: Verify zip file contents | |
| run: | | |
| unzip -l artne.zip | |
| unzip -p artne.zip .env | |
| - name: AWS configure credentials | |
| uses: aws-actions/configure-aws-credentials@v1 | |
| with: | |
| aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| aws-region: ap-northeast-2 | |
| - name: upload to S3 | |
| run: aws s3 cp --region ap-northeast-2 ./artne.zip s3://artne-build/deploy/ | |
| - name: deploy with AWS codeDeploy | |
| run: aws deploy create-deployment | |
| --application-name artne-codedeploy | |
| --deployment-config-name CodeDeployDefault.OneAtATime | |
| --deployment-group-name GROUP | |
| --s3-location bucket=artne-build,bundleType=zip,key=deploy/artne.zip |