Initialize authentication module implementation with JWT strategy and… #39
This file contains 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
name: CI | |
on: | |
push: | |
branches: [main] | |
env: | |
REGISTRY_IMAGE: vasapolrittideah/react-authentication | |
jobs: | |
install_deps: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Bun | |
uses: oven-sh/setup-bun@v1 | |
with: | |
bun-version: 'latest' | |
- uses: actions/cache@v4 | |
with: | |
path: ~/.bun/install/cache | |
key: ${{ runner.os }}-${{ matrix.bun }}-bun-${{ hashFiles('**/bun.lockb') }} | |
restore-keys: | | |
${{ runner.os }}-${{ matrix.bun }}-bun- | |
- name: Cache node_modules | |
id: cache-node_modules | |
uses: actions/cache@v3 | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/bun.lockb') }} | |
restore-keys: | | |
${{ runner.os }}-node_modules- | |
- name: Install dependencies | |
if: steps.cache-node_modules.outputs.cache-hit != 'true' | |
run: bun install | |
publish_image: | |
runs-on: ubuntu-latest | |
needs: install_deps | |
env: | |
DOCKER_TLS_CERTDIR: '/certs' | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Login to Docker Hub | |
run: docker login -u vasapolrittideah -p ${{ secrets.DOCKER_HUB_TOKEN }} | |
- name: Build and push image to Docker Hub | |
run: | | |
docker pull $REGISTRY_IMAGE:latest || true | |
docker build --cache-from $REGISTRY_IMAGE:latest --tag $REGISTRY_IMAGE:$GITHUB_SHA --tag $REGISTRY_IMAGE:latest -f ./dockerfiles/Dockerfile.prod . | |
docker push $REGISTRY_IMAGE:$GITHUB_SHA | |
docker push $REGISTRY_IMAGE:latest |