Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 78 additions & 0 deletions .github/workflows/apidoc-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Build and Upload

on:
push:
branches:
- master
- release
- 'sc-*'

env:
APP: "apidocs"
APP_RELEASY: "webapp-apidocs"
S3BUCKETCACHE: "aplazameshared-jenkins-cache"
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
AWS_PROFILE: "AplazameSharedServices"
AWS_REGION: "eu-west-1"
S3_BUCKET_STAGING: apidocs-staging.aplazame.org
S3_PATH_STAGING: build/staging
S3_BUCKET_PRODUCTION: aplazame.dev
S3_PATH_PRODUCTION: build/prod

permissions:
contents: read
id-token: write

jobs:
build-and-upload:
runs-on: ${{ vars.AWS_RG_NAME_PRO }}
env:
ENVIRONMENT: ${{ github.ref_name == 'master' && 'staging' || github.ref_name == 'release' && 'prod' || github.ref_name == 'sc-*' && 'ephemeral' }}
OUT_DIR: ${{ github.ref == 'refs/heads/master' && 'build/staging' || github.ref == 'refs/heads/release' && 'build/prod' || startsWith(github.ref, 'refs/heads/sc-') && 'build/staging' }}
S3_BUCKET: ${{ github.ref == 'refs/heads/master' && vars.S3_BUCKET_STAGING || github.ref == 'refs/heads/release' && vars.S3_BUCKET_PRODUCTION || startsWith(github.ref, 'refs/heads/sc-') && 'ephemeral-environments' }}
steps:
- name: Checkout code
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 #v6.0.1
with:
fetch-depth: 0
- name: Install AWS CLI
run: |
sudo apt-get install unzip curl -y
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install --update
aws --version
- name: Setup Node.js
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f #v6.1.0
with:
node-version: 16
cache: 'npm'

- name: Instalar dependencias Make
run: |
npm install --g yarn
sudo apt-get update
sudo apt-get install -y make build-essential
make install

- name: Configure aws credentials
uses: aws-actions/configure-aws-credentials@61815dcd50bd041e203e49132bacad1fd04d2708 #v5.1.1
with:
role-to-assume: ${{ vars.AWS_OIDC_ROLE_TF_PRO }}
role-session-name: ${{ github.run_id }}
aws-region: ${{ vars.WZ_OIDC_AWS_REGION }}

- name: Build Make
run: make build

- name: Deploy to S3 Bucket - ${{ github.ref_name }}
run: |
if [[ "${{ github.ref_name }}" == "master" || "${{ github.ref_name }}" == "release" ]]; then
echo "Deploying to ${{ env.ENVIRONMENT }} S3 bucket: ${{ env.S3_BUCKET }}"
aws --profile Aplazame s3 sync ${{ env.OUT_DIR }} s3://${{ env.S3_BUCKET }} --acl private --cache-control 'private, max-age:3600' --delete
aws --profile Aplazame s3 cp ${{ env.OUT_DIR }} s3://${{ env.S3_BUCKET }} --recursive --exclude '*' --include '*.html' --acl private --cache-control 'no-cache, no-store'
elif [[ "${{ github.ref_name }}" == sc-* ]]; then
echo "Deploy to ephemeral environment for branch ${{ github.ref_name }}"
aws --profile Aplazame s3 sync build/staging s3://ephemeral-environments/${{ env.APP }}/${{ env.BRANCH_NAME }} --acl public-read --cache-control "private, max-age:3600" --delete
aws --profile Aplazame s3 cp build/staging s3://ephemeral-environments/${{ env.APP }}/${{ env.BRANCH_NAME }} --recursive --exclude '*' --include '*.html' --acl public-read --cache-control 'no-cache, no-store'
fi
276 changes: 0 additions & 276 deletions Jenkinsfile

This file was deleted.

20 changes: 0 additions & 20 deletions jenkins/jenkins-sonar.yaml

This file was deleted.

21 changes: 0 additions & 21 deletions jenkins/node.yaml

This file was deleted.