Skip to content

Workflow file for this run

name: API Server CI/CD
on:
workflow_dispatch:
inputs:
deploy:
description: "Deploy? Set to true"
required: true
push:
paths:
- .github/workflows/apiserver.yml
- apiserver/**
jobs:
test:
runs-on: ubuntu-24.04
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20"
- name: Install eclint
run: npm install -g eclint
- name: Check EditorConfig compliance
run: eclint check $(git ls-files) apiserver
build:
runs-on: ubuntu-24.04
needs: test
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.2"
working-directory: apiserver
bundler-cache: true
env:
BUNDLE_DEPLOYMENT: "true"
BUNDLE_PATH: vendor/bundle
BUNDLE_JOBS: 4
BUNDLE_RETRY: 3
- name: Create tarball
run: >
tar
-c
--use-compress-program 'zstd -T0'
--sort name
--owner root:0
--group root:0
--mtime '2024-01-01 00:00Z'
--pax-option exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime
-f apiserver-"$GITHUB_RUN_NUMBER"-$(lsb_release --id --short | tr '[:upper:]' '[:lower:]')-$(lsb_release --release --short)-$(dpkg --print-architecture).tar.zst
-C apiserver
.
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: apiserver
path: "*.tar.zst"
compression-level: 0
deploy:
runs-on: ubuntu-24.04
needs: build
if: github.ref == 'refs/heads/hetzner' || github.event.inputs.deploy == 'true'
environment: deploy
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: apiserver
- name: Create tag
run: git tag -f apiserver-"$GITHUB_RUN_NUMBER"
- name: Push tag
run: git push origin apiserver-"$GITHUB_RUN_NUMBER"
- name: Create release
run: >
gh release create
apiserver-"$GITHUB_RUN_NUMBER"
apiserver-*.tar.zst
--title "apiserver v$GITHUB_RUN_NUMBER"
--notes-from-tag
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}