mirror of
https://github.com/henrygd/beszel.git
synced 2026-08-17 12:46:22 +00:00
125 lines
3.9 KiB
YAML
125 lines
3.9 KiB
YAML
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
permissions:
|
|
contents: write
|
|
issues: write
|
|
pull-requests: write
|
|
|
|
env:
|
|
PUBLISHABLE_ITEMS: '["supplemental/helm/beszel-agent", "supplemental/helm/beszel-hub"]'
|
|
|
|
name: helm-release
|
|
|
|
jobs:
|
|
release:
|
|
name: Release
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v5
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- uses: googleapis/release-please-action@v4
|
|
name: Prepare release
|
|
id: release-please
|
|
with:
|
|
token: ${{ secrets.CR_TOKEN }}
|
|
|
|
- name: Dump Release Please Output
|
|
env:
|
|
RELEASE_PLEASE_OUTPUT: ${{ toJson(steps.release-please.outputs) }}
|
|
run: |
|
|
echo "$RELEASE_PLEASE_OUTPUT"
|
|
|
|
- name: Determine what should be published
|
|
uses: actions/github-script@v8
|
|
id: items-to-publish
|
|
env:
|
|
CHANGED_ITEMS: "${{ steps.release-please.outputs.paths_released }}"
|
|
with:
|
|
script: |
|
|
const changedItems = JSON.parse(process.env.CHANGED_ITEMS || '[]');
|
|
console.log("changed items", changedItems);
|
|
const eligibleItems = JSON.parse(process.env.PUBLISHABLE_ITEMS || '[]');
|
|
console.log("eligible items", eligibleItems);
|
|
const itemsToPublish = changedItems.filter(i => eligibleItems.includes(i));
|
|
console.log("items to publish", itemsToPublish);
|
|
return itemsToPublish;
|
|
outputs:
|
|
items_to_publish: ${{ steps.items-to-publish.outputs.result }}
|
|
releases: ${{ toJson(steps.release-please.outputs) }}
|
|
|
|
release-charts:
|
|
name: Release Charts
|
|
needs: release
|
|
runs-on: ubuntu-latest
|
|
if: ${{ needs.release.outputs.items_to_publish != '' && toJson(fromJson(needs.release.outputs.items_to_publish)) != '[]' }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
path: ${{ fromJSON(needs.release.outputs.items_to_publish) }}
|
|
|
|
env:
|
|
TAG: ${{ fromJson(needs.release.outputs.releases)[format('{0}--tag_name', matrix.path)] }}
|
|
VERSION: ${{ fromJson(needs.release.outputs.releases)[format('{0}--version', matrix.path)] }}
|
|
|
|
steps:
|
|
- name: Debug
|
|
run: |
|
|
echo ${{ env.TAG }}
|
|
echo ${{ env.VERSION }}
|
|
echo ${{ matrix.path }}
|
|
|
|
- name: ✨ Checkout repository
|
|
uses: actions/checkout@v5
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Configure Git
|
|
run: |
|
|
echo ${{ needs.release.outputs.items_to_publish }}
|
|
git config user.name "$GITHUB_ACTOR"
|
|
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
|
|
|
|
- name: Install Chart Releaser
|
|
run: |
|
|
version=v1.6.0
|
|
mkdir .tmp
|
|
install_dir=.tmp
|
|
echo "Installing chart-releaser on $install_dir..."
|
|
curl -sSLo cr.tar.gz "https://github.com/helm/chart-releaser/releases/download/$version/chart-releaser_${version#v}_linux_amd64.tar.gz"
|
|
tar -xzf cr.tar.gz -C "$install_dir"
|
|
rm -f cr.tar.gz
|
|
|
|
- name: Package chart
|
|
run: |
|
|
.tmp/cr package ${{ matrix.path }}
|
|
ls -la .cr-release-packages/
|
|
|
|
- name: Upload binaries to release
|
|
uses: svenstaro/upload-release-action@v2
|
|
with:
|
|
repo_token: ${{ secrets.GITHUB_TOKEN }}
|
|
file: .cr-release-packages/*.tgz
|
|
file_glob: true
|
|
overwrite: true
|
|
tag: ${{ env.TAG }}
|
|
|
|
- name: Update index
|
|
run: |
|
|
owner=$(cut -d '/' -f 1 <<< "$GITHUB_REPOSITORY")
|
|
repo=$(cut -d '/' -f 2 <<< "$GITHUB_REPOSITORY")
|
|
|
|
# Create docs directory and copy chart
|
|
mkdir -p docs
|
|
cp .cr-release-packages/*.tgz docs/ || true
|
|
|
|
# Generate index.yaml for GitHub Pages
|
|
args=(-o "$owner" -r "$repo" -c "https://henrygd.github.io/beszel" --push -t "${{ secrets.CR_TOKEN }}" --index-path docs/index.yaml)
|
|
.tmp/cr index "${args[@]}"
|