Skip to content

Merge branch 'develop' #4

Merge branch 'develop'

Merge branch 'develop' #4

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:
filters: |
game-2048: src/game-2048/**
cow-demo: src/cow-demo/**
rancher-helloworld: src/rancher-helloworld/**
build:
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 }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
create-image:
if: needs.changes.outputs.apps != '[]'
strategy:
matrix:
app: ${{ fromJSON(needs.changes.outputs.apps) }}
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Login to container registry
uses: docker/login-action@v3
with:
registry: ${{ env.CONTAINER_REGITRY_DOMAIN }}
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build container image
run: |
cd src/${{ matrix.app }}
docker build . --tag $IMAGE_FOLDER/${{ matrix.app }}:${{ env.IMAGE_TAG }}
- name: Push image to container registry
run: docker push $IMAGE_FOLDER/${{ matrix.app }}:${{ env.IMAGE_TAG }}
- name: Push latest tag to container registry
if: ${{ github.ref_name == 'main' }}
run: |
docker tag $IMAGE_FOLDER/${{ matrix.app }}:${{ env.IMAGE_TAG }} $IMAGE_FOLDER/${{ matrix.app }}:latest
docker push $IMAGE_FOLDER/${{ matrix.app }}:latest
env:
CONTAINER_REGITRY_DOMAIN: docker.io
IMAGE_FOLDER: ${{ vars.DOCKERHUB_NAMESPACE }}
IMAGE_TAG: 1.0.${GITHUB_RUN_ID}