Docker #46
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: Docker | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '42 3 * * 6' | |
push: | |
branches: | |
- master | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Extract NSD version from Dockerfile | |
run: | | |
NSD_VERSION=$(grep "ARG NSD_VERSION" Dockerfile | cut -d= -f 2) | |
echo "NSD VERSION: $NSD_VERSION" | |
[ -z "$NSD_VERSION" ] && echo "Empty version string" && exit 1 | |
echo "NSD_VERSION=$NSD_VERSION" >> $GITHUB_ENV | |
- name: Setup tests | |
run: bash tests/setup.sh | |
- name: Run tests | |
run: bash tests/test.sh | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ secrets.GHCR_USERNAME }} | |
password: ${{ secrets.GHCR_TOKEN }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
push: true | |
tags: | | |
ghcr.io/the-kube-way/nsd:v${{ env.NSD_VERSION }} | |
ghcr.io/the-kube-way/nsd:latest |