Build Images & Deploy GH Pages #60
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: Build Images & Deploy GH Pages | |
on: | |
workflow_dispatch: | |
env: | |
REGISTRY: ghcr.io | |
USERNAME: ${{ github.actor }} | |
IMAGE_NAME: aellwein/cert-manager-webhook-netcup | |
# set version here for upcoming release | |
IMAGE_TAG: 1.0.19 | |
IMAGE_TAG_DEVELOP: develop | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Login to container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ env.USERNAME }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Setup Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build & push Docker image (all architectures) | |
uses: docker/build-push-action@v5 | |
if: github.ref == 'refs/heads/main' | |
with: | |
platforms: linux/arm/v7,linux/amd64,linux/arm64/v8,linux/ppc64le,linux/s390x | |
push: true | |
context: . | |
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} | |
# this is used mainly for testing | |
- name: Build & push Docker image (amd64 only for develop) | |
uses: docker/build-push-action@v5 | |
if: github.ref == 'refs/heads/develop' | |
with: | |
platforms: linux/amd64 | |
push: true | |
context: . | |
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG_DEVELOP }} | |
# Deploy GH Pages | |
deploy: | |
if: github.ref == 'refs/heads/main' | |
needs: build | |
runs-on: ubuntu-latest | |
permissions: | |
pages: write | |
id-token: write | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Pages | |
uses: actions/configure-pages@v4 | |
- name: Build with Jekyll | |
uses: actions/jekyll-build-pages@v1 | |
with: | |
source: ./ | |
destination: ./_site | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v2 | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v3 |