Skip to content

Merge pull request #88 from Krinkle/patch-1 #14

Merge pull request #88 from Krinkle/patch-1

Merge pull request #88 from Krinkle/patch-1 #14

Workflow file for this run

name: docker-deploy
on:
push:
branches:
- main
tags:
- '**'
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set ENV variables
run: |
echo "REGISTRY=ghcr.io" >> $GITHUB_ENV
echo "REPO_OWNER=$(echo ${GITHUB_REPOSITORY%/*})" >> $GITHUB_ENV
echo "REPO_NAME=$(echo ${GITHUB_REPOSITORY#*/})" >> $GITHUB_ENV
echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV
echo "DOCKER_TAG=$(echo ${GITHUB_REPOSITORY#*/}):$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/[email protected]
with:
install: true
- name: Login to GitHub Container Registry
uses: docker/[email protected]
with:
registry: ${{env.REGISTRY}}
username: ${{env.REPO_OWNER}}
password: ${{secrets.CR_PAT}}
- name: Build and push
uses: docker/[email protected]
with:
context: .
file: ./Dockerfile
push: true
tags: ${{env.REGISTRY}}/${{env.REPO_OWNER}}/${{env.DOCKER_TAG}}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Execute tests
run: docker run -t --entrypoint="npm" ${REGISTRY}/${REPO_OWNER}/${DOCKER_TAG} run test