Workflow file for this run
This file contains hidden or 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
on: | ||
push: | ||
branches: | ||
# - develop | ||
- feature/cicd | ||
tags: | ||
- "*" | ||
workflow_dispatch: | ||
inputs: | ||
environment: | ||
required: true | ||
default: "mango_ui" | ||
jobs: | ||
build_mango_ui: | ||
name: Build & Test MANGO UI | ||
environment: mango_ui | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repo content | ||
uses: actions/checkout@v4 | ||
- name: Setup Node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18.18 | ||
- name: Install dependencies | ||
run: | | ||
npm ci | ||
shell: bash | ||
- name: Import certificates and keys | ||
run: | | ||
mkdir -p .cert | ||
echo "${{ secrets.KEY }}" > .cert/key.pem | ||
echo "${{ secrets.CERTIFICATE }}" > .cert/cert.pem | ||
chmod 600 .cert/key.pem .cert/cert.pem | ||
shell: bash | ||
- name: Build application | ||
run: | | ||
npm run build | ||
printenv | ||
shell: bash | ||
build_docker_image: | ||
name: Build Docker Image | ||
environment: mango_ui | ||
runs-on: ubuntu-latest | ||
needs: [build_mango_ui] | ||
if: github.ref == 'refs/heads/feature/cicd' && ${{ needs.build_mango_ui.result == 'success' | ||
Check failure on line 52 in .github/workflows/build.yml
|
||
steps: | ||
- name: Create env variable of lowercase GitHub repo name | ||
run: | | ||
GITHUB_REPO_LOWER=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]') | ||
echo "GITHUB_REPO_LOWER=$GITHUB_REPO_LOWER" >>${GITHUB_ENV} | ||
shell: bash | ||
- name: Set docker tag environment variable | ||
run: | | ||
GITHUB_REF_NAME_CLEAN="${GITHUB_REF_NAME//\//_}" | ||
DOCKER_TAG="ghcr.io/${{ env.GITHUB_REPO_LOWER }}:${GITHUB_REF_NAME_CLEAN}" | ||
echo "DOCKER_TAG=$DOCKER_TAG" >>${GITHUB_ENV} | ||
- name: Log in to GitHub Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ github.token }} | ||
- name: Build and push algorithm Docker image | ||
id: push-algorithm | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: . | ||
file: Dockerfile | ||
push: true | ||
tags: ${{ env.DOCKER_TAG }} |