129 lines
3.6 KiB
YAML
129 lines
3.6 KiB
YAML
---
|
|
name: Gitea Actions Demo
|
|
run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀
|
|
|
|
on:
|
|
schedule:
|
|
- cron: "0 10 * * *"
|
|
push:
|
|
branches:
|
|
- "**"
|
|
tags:
|
|
- "v*.*.*"
|
|
pull_request:
|
|
|
|
jobs:
|
|
lint:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
checks: write
|
|
contents: write
|
|
steps:
|
|
- name: Login to Docker
|
|
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
|
|
with:
|
|
username: ${{ vars.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
- name: Checkout
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
|
|
- name: Ruby Setup
|
|
uses: ruby/setup-ruby@dffc446db9ba5a0c4446edb5bca1c5c473a806c5 # v1.235.0
|
|
with:
|
|
ruby-version: '3.4'
|
|
bundler-cache: true
|
|
|
|
- run: bundle install
|
|
|
|
- name: Standard Ruby
|
|
run: bundle exec standardrb
|
|
|
|
|
|
test:
|
|
needs: lint
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
|
|
- name: Test
|
|
uses: ruby/setup-ruby@dffc446db9ba5a0c4446edb5bca1c5c473a806c5 # v1.235.0
|
|
with:
|
|
ruby-version: '3.4'
|
|
bundler-cache: true
|
|
|
|
- run: bundle exec rake
|
|
|
|
docker:
|
|
needs: test
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: catthehacker/ubuntu:act-latest
|
|
env:
|
|
DOCKER_ORG: ryanc
|
|
DOCKER_LATEST: latest
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
with:
|
|
fetch-depth: 0 # all history for all branches and tags
|
|
|
|
- name: Prepare
|
|
id: prep
|
|
run: |
|
|
VERSION="sha-${GITHUB_SHA::8}"
|
|
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
|
|
VERSION="${GITHUB_REF/refs\/tags\//}"
|
|
fi
|
|
printf "GITHUB_REF=%s\n" "$GITHUB_REF"
|
|
printf "GITHUB_SHA=%s\n" "$GITHUB_SHA"
|
|
printf "VERSION=%s\n" "$VERSION" | tee -a "$GITHUB_OUTPUT"
|
|
|
|
- name: Docker meta
|
|
id: meta
|
|
uses: docker/metadata-action@902fa8ec7d6ecbf8d84d538b9b233a880e428804 # v5.7.0
|
|
with:
|
|
images: |
|
|
git.kill0.net/ryanc/kubernaut
|
|
tags: |
|
|
type=schedule
|
|
type=ref,event=branch
|
|
type=ref,event=pr
|
|
type=semver,pattern={{version}}
|
|
type=semver,pattern={{major}}.{{minor}}
|
|
type=semver,pattern={{major}}
|
|
type=sha
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3.10.0
|
|
|
|
- name: Login to Gitea registry
|
|
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
|
|
with:
|
|
registry: git.kill0.net
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
|
|
- name: Docker build and push
|
|
uses: docker/build-push-action@14487ce63c7a62a4a324b0bfb37086795e31c6c1
|
|
# v6.16.0
|
|
with:
|
|
push: ${{ github.event_name != 'pull_request' }}
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
|
|
- name: Setup Helm
|
|
uses: azure/setup-helm@v4.3.0
|
|
|
|
- name: Publish Helm chart
|
|
if: ${{ contains(github.ref, 'refs/tags/') }}
|
|
run: |
|
|
HELM_VERSION="${{ steps.prep.outputs.VERSION }}"
|
|
HELM_VERSION="${HELM_VERSION#v}"
|
|
helm package charts/kubernaut
|
|
helm push "kubernaut-${HELM_VERSION}.tgz" oci://git.kill0.net/ryanc/helm-charts
|