Skip to content

Merge pull request #212 from Fachinformatiker-Prufungsvorbereitung/dev #114

Merge pull request #212 from Fachinformatiker-Prufungsvorbereitung/dev

Merge pull request #212 from Fachinformatiker-Prufungsvorbereitung/dev #114

name: HugoBuildAndDeploy
on:
workflow_dispatch: # To have the ability to run the workflow manually
push:
branches: [main]
env:
NAME: ./
CONTAINER-NAME: fi-pv
jobs:
ReleaseVersion:
runs-on: ubuntu-latest
steps:
# Checkout the repository
- uses: actions/checkout@v3
# Install Hugo
- name: Hugo setup
uses: peaceiris/[email protected]
with:
extended: true
# Build the hugo repository
- run: hugo
working-directory: ./${{ env.NAME }}/
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build the Docker image
run: docker build . --file ./${{ env.NAME }}/deployment/Dockerfile --tag lnadev/${{ env.CONTAINER-NAME }}:${{ github.run_number }}
- name: Push the image to dockerhub
run: docker push lnadev/${{ env.CONTAINER-NAME }}:${{ github.run_number }}
ReleaseLatest:
runs-on: ubuntu-latest
steps:
# Checkout the repository
- uses: actions/checkout@v3
# Install Hugo
- name: Hugo setup
uses: peaceiris/[email protected]
with:
extended: true
# Build the hugo repository
- run: hugo
working-directory: ./${{ env.NAME }}/
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build the Docker image
run: docker build . --file ./${{ env.NAME }}/deployment/Dockerfile --tag lnadev/${{ env.CONTAINER-NAME }}:latest
- name: Push the image to dockerhub
run: docker push lnadev/${{ env.CONTAINER-NAME }}:latest
DeployContainer:
needs: ReleaseVersion
runs-on: ubuntu-latest
steps:
# Download Secure-File
- name: base64-to-file
id: write_file
uses: timheuer/[email protected]
with:
fileName: "custom-config"
encodedString: ${{ secrets.KUBECTL_CONFIG }}
# Checkout the repository
- uses: actions/checkout@v3
# Deploy Kubernetes YAML
- run: helm upgrade --install fi-pv ./helm --kubeconfig ${{ steps.write_file.outputs.filePath }} --set runNumber=${{ github.run_number }}