Skip to content

Added kubernetes manifest #122

Added kubernetes manifest

Added kubernetes manifest #122

Workflow file for this run

name: Build and Publish Docker Image
on:
push:
branches:
- main
- development
tags:
- v*
- rc-*
pull_request:
branches:
- main
- development
jobs:
setup:
runs-on: ubuntu-latest
outputs:
lowercase: ${{ steps.lowercase.outputs.LOWERCASE }}
is_pr: ${{ steps.pr.outputs.IS_PR }}
tag_name: ${{ steps.tag.outputs.TAG_NAME }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Convert repository owner to lowercase
id: lowercase
run: echo "LOWERCASE=$(echo ${{ github.repository_owner }} | awk '{print tolower($0)}')" >> $GITHUB_OUTPUT
- name: Check if currently in a pull request
id: pr
run: echo "IS_PR=$(test -n "${{ github.event.pull_request }}" && echo "true" || echo "false")" >> $GITHUB_OUTPUT
- name: Create the tag name
id: tag
run: |
if [[ "${{ github.ref_type }}" == "tag" ]]; then
echo "TAG_NAME=$(echo ${{ github.ref_name }} | sed 's/^v//')" >> $GITHUB_OUTPUT
elif [[ "${{ github.ref_name }}" == "main" ]]; then
echo "TAG_NAME=latest" >> $GITHUB_OUTPUT
else
if [[ "${{ steps.pr.outputs.IS_PR }}" == "true" ]]; then
echo "TAG_NAME=pr-${{ github.event.pull_request.number }}" >> $GITHUB_OUTPUT
else
echo "TAG_NAME=${{ github.ref_name }}" >> $GITHUB_OUTPUT
fi
fi
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install node
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: "npm"
- name: Install dependencies
run: npm ci
- name: Run eslint
run: npm run lint
test:
runs-on: ubuntu-latest
env:
LONG_LIVED_TOKENS_ENABLED: true
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install node
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: "npm"
- name: Install dependencies
run: npm ci
- name: Run tests
run: npm run test
e2e-tests:
runs-on: ubuntu-latest
env:
AUTH_HOST: localhost:3000
COOKIE_HOST: localhost:3000
ACCESS_TOKEN_SECRET: test_secret
REFRESH_TOKEN_SECRET: test_refresh_secret
LOCAL_HTPASSWD_USERS: testuser:$apr1$O8Mf7wjR$mNmtP69.Xvv6YYG5JXixd/
LONG_LIVED_TOKENS_ENABLED: true
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Run Cypress tests
uses: cypress-io/github-action@v6
with:
start: npm start
wait-on: "http://localhost:3000/healthz"
build-and-push:
runs-on: ubuntu-latest
needs: [setup, lint, test, e2e-tests]
if: ${{ needs.setup.outputs.is_pr == 'false' }}
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Registry
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to Nexus Docker Registry
uses: docker/login-action@v3
with:
registry: nexus.roelc.dev
username: ${{ vars.NEXUS_USERNAME }}
password: ${{ secrets.NEXUS_PASSWORD }}
- name: Build and push
uses: docker/build-push-action@v5
with:
push: true
tags: |
${{ needs.setup.outputs.lowercase }}/authentication-proxy:${{ needs.setup.outputs.tag_name }}
ghcr.io/${{ needs.setup.outputs.lowercase }}/authentication-proxy:${{ needs.setup.outputs.tag_name }}
nexus.roelc.dev/authentication-proxy:${{ needs.setup.outputs.tag_name }}
cache-from: type=gha
cache-to: type=gha,mode=max