Skip to content

[workflows/ci-cd] Add CI/CD Workflow #24

[workflows/ci-cd] Add CI/CD Workflow

[workflows/ci-cd] Add CI/CD Workflow #24

Workflow file for this run

name: CI/CD
on:
pull_request:
branches:
- main
types:
- closed
- synchronize
- opened
workflow_dispatch:
env:
REGISTRY: docker.io
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set environment variables
run: |
SHA=${{ hashFiles('**/package-lock.json') }}
TAG=${SHA:0:10}
OWNER=${{ github.repository_owner }}
BUILDER_STRING=${REGISTRY}/${GITHUB_REPOSITORY}:builder-${TAG}
CONTEXT="./"
echo "BUILDER_STRING=$BUILDER_STRING" >> $GITHUB_ENV
echo "OWNER=$OWNER >> $GITHUB_ENV"
echo "CONTEXT=$CONTEXT" >> $GITHUB_ENV
- name: Build builder image
run: |
echo $BUILDER_STRING
echo $OWNER
echo $CONTEXT
echo $(docker manifest inspect $BUILDER_STRING > /dev/null ; echo $?)
# if docker manifest inspect $BUILDER_STRING >/dev/null;
# then
# exit 0
# fi
# docker login -u=$OWNER -p=${{ secrets.DOCKER_CI_TOKEN }} docker.io
# docker buildx create --use --driver=docker-container
# docker buildx build --push -t $BUILDER_STRING \
# --cache-from type=registry,ref=$BUILDER_STRING \
# --cache-to type=registry,ref=$BUILDER_STRING \
# ${CONTEXT}
# echo "Published image $BUILDER_STRING"
# docker logout