Merge pull request #2 from AyupDigital/feature/sc-4534/spin-up-h-f-st… #2
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: Deploy Staging to AWS | |
on: | |
push: | |
branches: | |
- 'develop' | |
workflow_dispatch: | |
env: | |
ENVIRONMENT: 'staging' | |
jobs: | |
deploy: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v4 | |
with: | |
sparse-checkout: | | |
public | |
src | |
browserslistrc | |
jsconfig.json | |
package-lock.json | |
package.json | |
postcss.config.js | |
vue.config.js | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 14.15 | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-access-key-id: ${{ env.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ env.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ${{ env.AWS_DEFAULT_REGION }} | |
env: | |
AWS_ACCESS_KEY_ID: ${{vars.AWS_ACCESS_KEY_ID_STAGING}} | |
AWS_SECRET_ACCESS_KEY: ${{secrets.AWS_SECRET_ACCESS_KEY_STAGING}} | |
AWS_DEFAULT_REGION: ${{vars.AWS_DEFAULT_REGION_STAGING}} | |
- name: Install NPM dependencies | |
run: | | |
npm ci | |
npm run prod | |
rm -rf node_modules | |
- name: Download the secret | |
uses: aws-actions/aws-secretsmanager-get-secrets@v2 | |
with: | |
secret-ids: | | |
ENV_SECRET, ${{env.ENV_SECRET_ID}} | |
env: | |
ENV_SECRET_ID: .env.admin.${{env.ENVIRONMENT}} | |
- name: Store secret value to .env | |
env: | |
ENV_SECRET: ${{env.ENV_SECRET}} | |
shell: bash | |
run: echo "$ENV_SECRET" >> .env | |
- name: Build the Vue app | |
shell: bash | |
run: node_modules/.bin/vue-cli-service build --mode ${{env.ENVIRONMENT}} | |
- name: Deploy to S3 | |
shell: bash | |
run: node_modules/.bin/vue-cli-service s3-deploy --mode ${{env.ENVIRONMENT}} |