Publish #236
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: Publish | |
defaults: | |
run: | |
shell: bash # Every steps will have a /usr/bin/bash --noprofile --norc -e -o pipefail | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
concurrency: | |
group: ${{ github.workflow }} | |
cancel-in-progress: true | |
permissions: | |
actions: write | |
contents: read | |
id-token: write | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
steps: | |
- name: Checkout current project | |
uses: actions/checkout@v4 | |
- name: Setup Hugo | |
uses: peaceiris/actions-hugo@v2 | |
with: | |
hugo-version: '0.119.0' | |
extended: true | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '18' | |
- name: Cache dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Generate site | |
run: ./bin/entrypoint.sh generate | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-region: eu-west-3 | |
role-to-assume: ${{ secrets.AWS_ROLE_PROD_DOC }} | |
- name: Deploy | |
run: | | |
sed -i 's/HUGO_DEPLOYMENT_BUCKET/${{ secrets.HUGO_DEPLOYMENT_BUCKET }}/' config/production/config.yaml | |
hugo deploy | |
publish: | |
needs: deploy | |
if: github.ref == 'refs/heads/main' | |
runs-on: ubuntu-latest | |
environment: | |
name: prod | |
url: https://gatling.io/docs | |
timeout-minutes: 10 | |
steps: | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-region: eu-west-3 | |
role-to-assume: ${{ secrets.AWS_ROLE_PROD_DOC }} | |
- name: Publish | |
run: | | |
aws ssm start-associations-once --association-id "${{ secrets.AWS_SSM_ASSOCIATION_MEP_WEBSITE_DOC_PROD }}" |