Skip to content

turn off exposed server versions #874

turn off exposed server versions

turn off exposed server versions #874

Workflow file for this run

name: "API - Common"
on:
push:
paths:
- "sourcecode/apis/common/**"
- ".github/workflows/api-common.yaml"
workflow_call:
inputs:
versionToRelease:
description: 'A version to release'
required: true
type: string
secrets:
AWS_DOCKER_REGISTRY_ACCESS_KEY_ID:
required: true
AWS_DOCKER_REGISTRY_SECRET_ACCESS_KEY:
required: true
env:
workingDirectory: sourcecode/apis/common
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
- name: Cache composer dependencies
uses: actions/cache@v3
with:
path: vendor
key: composer-${{ hashFiles('composer.lock') }}
- name: Run composer install
run: cd ${{ env.workingDirectory }}; composer install -n --prefer-dist
env:
APP_ENV: testing
- name: Prepare Laravel Application
run: |
cd ${{ env.workingDirectory }};
cp .env.example .env
php artisan key:generate
- name: Run tests
run: cd ${{ env.workingDirectory }};./vendor/bin/phpunit
env:
APP_ENV: testing
- name: Upload artifacts
uses: actions/upload-artifact@master
if: failure()
with:
name: Logs
path: ./storage/logs
create_release:
runs-on: ubuntu-latest
needs: test
if: ${{ inputs.versionToRelease }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_DOCKER_REGISTRY_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_DOCKER_REGISTRY_SECRET_ACCESS_KEY }}
aws-region: eu-west-1
role-duration-seconds: 3600
role-session-name: GithubCerpusPushImage
- name: Login to AWS docker registry
shell: bash
run: aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws
- name: Build and push web container
id: docker_build_web
uses: docker/build-push-action@v4
with:
push: true
tags: public.ecr.aws/f0t8l9h1/api-common-web:${{ inputs.versionToRelease }}
context: sourcecode/apis/common
target: web
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Build and push fpm container
id: docker_build_fpm
uses: docker/build-push-action@v4
with:
push: true
tags: public.ecr.aws/f0t8l9h1/api-common-fpm:${{ inputs.versionToRelease }}
context: sourcecode/apis/common
target: prod
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Build and push migration container
id: docker_build_migration
uses: docker/build-push-action@v4
with:
push: true
tags: public.ecr.aws/f0t8l9h1/api-common-migration:${{ inputs.versionToRelease }}
context: sourcecode/apis/common
target: deploy
cache-from: type=gha
cache-to: type=gha,mode=max