Skip to content

Merge pull request #9 from SUSE/develop #10

Merge pull request #9 from SUSE/develop

Merge pull request #9 from SUSE/develop #10

Workflow file for this run

name: PKG
on:
push:
branches:
- "main"
workflow_dispatch:
permissions:
contents: write
pages: write
id-token: write
jobs:
changes:
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
apps: ${{ steps.filter.outputs.changes }}
steps:
- name: Check-out the repository
uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
base: ${{ github.ref }}
filters: |
game-2048: src/game-2048/**
cow-demo: src/cow-demo/**
rancher-helloworld: src/rancher-helloworld/**
build:
if: ${{ github.ref_name == 'main' }}
runs-on: ubuntu-latest
steps:
- name: Check-out the repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
- name: Install Helm
uses: azure/[email protected]
with:
version: v3.14.0
- name: Add dependency Helm chart repositories
run: |
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo update
- name: Host charts repository on GitHub Pages
uses: helm/[email protected]
with:
skip_existing: true
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- name: Checkout gh-pages branch
uses: actions/checkout@v4
with:
ref: gh-pages
- name: Setup Go environment
uses: actions/setup-go@v5
- name: Generate index.html
run: |
go install github.com/halkeye/[email protected]
/home/runner/go/bin/helm-repo-html
- name: Setup Pages
uses: actions/configure-pages@v1
- name: Build with Jekyll
uses: actions/jekyll-build-pages@v1
with:
source: ./
destination: ./_site
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
needs: build
if: ${{ github.ref_name == 'main' }}
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
create-image:
needs: changes
if: needs.changes.outputs.apps != '[]'
strategy:
matrix:
app: ${{ fromJSON(needs.changes.outputs.apps) }}
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
attestations: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Login to container registry
uses: docker/login-action@v3
with:
registry: ${{ env.CONTAINER_REGISTRY_DOMAIN }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build container image
run: |
cd src/${{ matrix.app }}
docker build . --tag ${{ env.CONTAINER_REGISTRY_DOMAIN }}/${{ env.IMAGE_FOLDER }}/${{ matrix.app }}:${{ env.IMAGE_TAG }}
- name: Push image to container registry
run: docker push ${{ env.CONTAINER_REGISTRY_DOMAIN }}/${{ env.IMAGE_FOLDER }}/${{ matrix.app }}:${{ env.IMAGE_TAG }}
- name: Push latest tag to container registry
if: ${{ github.ref_name == 'main' }}
run: |
docker tag ${{ env.CONTAINER_REGISTRY_DOMAIN }}/${{ env.IMAGE_FOLDER }}/${{ matrix.app }}:${{ env.IMAGE_TAG }} ${{ env.CONTAINER_REGISTRY_DOMAIN }}/${{ env.IMAGE_FOLDER }}/${{ matrix.app }}:latest
docker push ${{ env.CONTAINER_REGISTRY_DOMAIN }}/${{ env.IMAGE_FOLDER }}/${{ matrix.app }}:latest
env:
CONTAINER_REGISTRY_DOMAIN: ghcr.io
IMAGE_FOLDER: suse
IMAGE_TAG: 1.0.${GITHUB_RUN_ID}