Skip to content

Merge pull request #781 from CSSSR/news-245 #366

Merge pull request #781 from CSSSR/news-245

Merge pull request #781 from CSSSR/news-245 #366

name: Деплой блога на прод
on:
push:
branches:
- master
concurrency: production_environment
jobs:
deploy:
name: Сборка прода
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
deployments: write
steps:
- name: Download CSSSR actions
uses: actions/checkout@v2
with:
repository: CSSSR/actions
ssh-key: ${{ secrets.DOWNLOAD_ACTIONS_SSH_KEY }}
path: actions
- uses: actions/checkout@v2
with:
path: new_blog_prod
ref: ${{ github.event.pull_request.head.sha }}
- uses: actions/setup-node@v3
with:
node-version: 16
registry-url: 'https://npm.pkg.github.com'
scope: '@csssr'
- name: Install dependencies
working-directory: new_blog_prod
run: yarn install --frozen-lockfile
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_GITHUB_REGISTRY_TOKEN }}
- name: Build prod
working-directory: new_blog_prod
run: yarn build
env:
IS_PRODUCTION: 'TRUE'
BLOG_HOST: https://blog.csssr.com
COM_HOST: https://csssr.com
- name: Import secrets
id: secrets
uses: hashicorp/[email protected]
with:
url: https://vault.csssr.com:8200
jwtGithubAudience: ${{secrets.VAULT_JWT_KEY}}
role: s3-cdn-upload
method: jwt
exportEnv: false
secrets: |
aws/sts/s3-cdn-upload access_key | AWS_ACCESS_KEY_ID ;
aws/sts/s3-cdn-upload secret_key | AWS_SECRET_ACCESS_KEY ;
aws/sts/s3-cdn-upload security_token | AWS_SESSION_TOKEN ;
- name: Деплой на продакшен
uses: ./actions/deploy-static-site/v1beta1
with:
auth: 'aws:${{steps.secrets.outputs.AWS_ACCESS_KEY_ID}}:${{steps.secrets.outputs.AWS_SECRET_ACCESS_KEY}}:${{steps.secrets.outputs.AWS_SESSION_TOKEN}}'
token: ${{ secrets.GITHUB_TOKEN }}
site-type: mpa
project-id: csssr-new-blog
files: ./new_blog_prod/out
no-previous-files: 'true'
not-found-page: 404/index.html
host: blog.csssr.com
environment: production
values: |
cache: etag-only
reduceHttpRedirects: enabled
ingress:
annotations:
nginx.ingress.kubernetes.io/server-snippet: |
rewrite ^/$ https://$http_host/en redirect;