mirror of
https://github.com/labring/sealos.git
synced 2026-09-21 05:44:43 +08:00
116 lines
3.8 KiB
YAML
116 lines
3.8 KiB
YAML
name: Build Cloud Cluster image
|
|
|
|
on:
|
|
release:
|
|
types: [ published ]
|
|
workflow_dispatch:
|
|
inputs:
|
|
push_image:
|
|
description: 'Push image'
|
|
required: false
|
|
type: boolean
|
|
default: false
|
|
push_image_tag:
|
|
description: 'Push all-in-one image tag, default is latest'
|
|
default: 'latest'
|
|
required: false
|
|
type: string
|
|
build_from:
|
|
description: 'Build all-in-one image from components image tag, default is nightly'
|
|
default: 'nightly'
|
|
required: false
|
|
type: string
|
|
push:
|
|
branches: [ "main" ]
|
|
paths:
|
|
- "deploy/cloud/**"
|
|
- ".github/workflows/cloud.yml"
|
|
- "!**/*.md"
|
|
- "!**/*.yaml"
|
|
pull_request:
|
|
branches: [ "*" ]
|
|
paths:
|
|
- "deploy/cloud/**"
|
|
- ".github/workflows/cloud.yml"
|
|
- "!**/*.md"
|
|
- "!**/*.yaml"
|
|
|
|
env:
|
|
# Common versions
|
|
GO_VERSION: "1.20"
|
|
DEFAULT_OWNER: "labring"
|
|
|
|
jobs:
|
|
save-sealos:
|
|
uses: ./.github/workflows/import-save-sealos.yml
|
|
|
|
build-cluster-image:
|
|
if: ${{ (github.event_name == 'release') ||(github.event_name == 'push') || (inputs.push_image == true) }}
|
|
needs:
|
|
- save-sealos
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
- name: Expose git commit data
|
|
uses: rlespinasse/git-commit-data-action@v1
|
|
- name: Check if tag
|
|
id: check_tag
|
|
run: |
|
|
if [[ "${{ github.ref }}" == refs/tags/* ]]; then
|
|
echo "isTag=true" >> "$GITHUB_OUTPUT"
|
|
else
|
|
echo "isTag=false" >> "$GITHUB_OUTPUT"
|
|
fi
|
|
- name: Prepare
|
|
id: prepare
|
|
run: |
|
|
bash ./scripts/resolve-tag-image.sh "${{ inputs.push_image }}" "${{ steps.check_tag.outputs.isTag }}" "${{ inputs.push_image_tag }}"
|
|
echo repo=ghcr.io/${{ github.repository_owner }}/sealos-cloud >> $GITHUB_OUTPUT
|
|
- name: Download sealos
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
name: sealos
|
|
path: /tmp/
|
|
- name: Verify sealos
|
|
run: |
|
|
sudo chmod a+x /tmp/sealos
|
|
sudo mv /tmp/sealos /usr/bin/sealos
|
|
sudo sealos version
|
|
|
|
# todo: mutate image tag in images/shim and scripts or change scripts to use changeable tags
|
|
|
|
- name: Sealos login to ghcr.io
|
|
# if push to master, then login to ghcr.io
|
|
run: |
|
|
sudo sealos login -u ${{ github.repository_owner }} -p ${{ secrets.GH_PAT }} --debug ghcr.io
|
|
|
|
- name: Build sealos cloud cluster image
|
|
working-directory: deploy/cloud
|
|
run: |
|
|
[ -z "${{ inputs.build_from }}" ] && BuildFromTag="nightly" || BuildFromTag="${{ inputs.build_from }}"; echo "BuildFromTag=${BuildFromTag}"
|
|
sed -i "s#nightly#${BuildFromTag}#g" init.sh
|
|
sed -i "s#nightly#${BuildFromTag}#g" etc/sealos/desktop-config.yaml
|
|
sudo bash init.sh
|
|
sudo sealos build -t ${{ steps.prepare.outputs.repo }}:${{ steps.prepare.outputs.tag_name }} -f Kubefile
|
|
sudo sealos push ${{ steps.prepare.outputs.repo }}:${{ steps.prepare.outputs.tag_name }}
|
|
|
|
# todo: build multi-arch images
|
|
|
|
- name: Renew issue and Sync Images
|
|
uses: labring/gh-rebot@v0.0.6
|
|
if: ${{ github.repository_owner == env.DEFAULT_OWNER }}
|
|
with:
|
|
version: v0.0.8-rc1
|
|
env:
|
|
GH_TOKEN: "${{ secrets.GH_PAT }}"
|
|
SEALOS_TYPE: "issue_renew"
|
|
SEALOS_ISSUE_TITLE: "[DaylyReport] Auto build for sealos"
|
|
SEALOS_ISSUE_BODYFILE: "scripts/ISSUE_RENEW.md"
|
|
SEALOS_ISSUE_LABEL: "dayly-report"
|
|
SEALOS_ISSUE_TYPE: "day"
|
|
SEALOS_ISSUE_REPO: "labring-actions/cluster-image"
|
|
SEALOS_COMMENT_BODY: "/imagesync ghcr.io/${{ github.repository_owner }}/sealos-cloud:${{ steps.prepare.outputs.tag_name }}"
|