Skip to content

update release error (#3132) #3

update release error (#3132)

update release error (#3132) #3

Workflow file for this run

name: Build Frontend Image
on:
create:
tags:
workflow_dispatch:
inputs:
push_image:
description: 'Push image'
required: false
type: boolean
default: false
push_image_tag:
description: 'Push image tag'
default: 'dev'
required: false
type: string
push:
branches: ['main']
paths:
- 'frontend/desktop/**'
- 'frontend/providers/**'
- '.github/workflows/frontend.yml'
- '!**/*.md'
- '!**/*.yaml'
pull_request:
branches: ['*']
paths:
- 'frontend/desktop/**'
- 'frontend/providers/**'
- '.github/workflows/frontend.yml'
- '!**/*.md'
- '!**/*.yaml'
env:
# Common versions
GO_VERSION: '1.20'
DEFAULT_OWNER: 'labring'
jobs:
image-build:
runs-on: ubuntu-latest
strategy:
matrix:
module:
[
providers/adminer,
providers/applaunchpad,
providers/bytebase,
providers/imagehub,
providers/terminal,
desktop,
]
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 }}"
- name: Extract module name
id: module_name
run: |
MODULE_NAME=$(basename ${{ matrix.module }})
echo "MODULE_NAME=${MODULE_NAME}" >> $GITHUB_ENV
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: |
ghcr.io/${{ github.repository_owner }}/sealos-${{ env.MODULE_NAME }}-frontend
tags: |
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'main') }}
type=raw,value=dev,enable=true
type=raw,value=${{ steps.prepare.outputs.tag_name }},enable=true
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Github Container Hub
if: ${{ (github.event_name == 'push') ||(github.event_name == 'create') || (inputs.push_image == true) }}
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GH_PAT }}
- name: Build And Push
uses: docker/build-push-action@v4
with:
context: ./frontend/${{ matrix.module }}
file: ./frontend/${{ matrix.module }}/Dockerfile
# Push if it's a push event or if push_image is true
push: ${{ (github.event_name == 'push') ||(github.event_name == 'create') || (inputs.push_image == true) }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
save-sealos:
uses: ./.github/workflows/import-save-sealos.yml
cluster-image-build:
if: ${{ (github.event_name == 'push') ||(github.event_name == 'create') || (inputs.push_image == true) }}
needs:
- image-build
- save-sealos
runs-on: ubuntu-latest
strategy:
matrix:
module:
[
providers/adminer,
providers/applaunchpad,
providers/bytebase,
providers/imagehub,
providers/terminal,
desktop,
]
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Extract module name
id: module_name
run: |
MODULE_NAME=$(basename ${{ matrix.module }})
echo "MODULE_NAME=${MODULE_NAME}" >> $GITHUB_ENV
- 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: |
tag_name=$(bash ./scripts/resolve-tag-image.sh "${{ inputs.push_image }}" "${{ steps.check_tag.outputs.isTag }}" "${{ inputs.push_image_tag }}")
echo old_docker_repo=ghcr.io/labring/sealos-${{ env.MODULE_NAME }}-frontend >> $GITHUB_OUTPUT
echo old_docker_image=ghcr.io/labring/sealos-${{ env.MODULE_NAME }}-frontend:dev >> $GITHUB_OUTPUT
echo new_docker_repo=ghcr.io/${{ github.repository_owner }}/sealos-${{ env.MODULE_NAME }}-frontend >> $GITHUB_OUTPUT
echo new_docker_image=ghcr.io/${{ github.repository_owner }}/sealos-${{ env.MODULE_NAME }}-frontend:${tag_name} >> $GITHUB_OUTPUT
echo cluster_repo=ghcr.io/${{ github.repository_owner }}/sealos-cloud-${{ env.MODULE_NAME }}-frontend >> $GITHUB_OUTPUT
echo cluster_image=ghcr.io/${{ github.repository_owner }}/sealos-cloud-${{ env.MODULE_NAME }}-frontend:${tag_name} >> $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
- name: Sealos login to ghcr.io
run: |
sudo sealos login -u ${{ github.repository_owner }} -p ${{ secrets.GH_PAT }} --debug ghcr.io
- name: Build ${{ env.MODULE_NAME }}-frontend cluster image
working-directory: frontend/${{ matrix.module }}/deploy
run: |
sudo sed -i "s;${{ steps.prepare.outputs.old_docker_image }};${{ steps.prepare.outputs.new_docker_image }};" manifests/*
sudo sealos build -t ${{ steps.prepare.outputs.cluster_image }}-amd64 --platform linux/amd64 -f Kubefile
# delete old registry cache
sudo rm -rf registry
sudo sealos build -t ${{ steps.prepare.outputs.cluster_image }}-arm64 --platform linux/arm64 -f Kubefile
- name: Manifest Cluster Images
run: |
CLUSTER_IMAGE_NAME=${{ steps.prepare.outputs.cluster_image }}
sudo sealos images
bash docker/patch/manifest-cluster-images.sh $CLUSTER_IMAGE_NAME
env:
OWNER: ${{ github.repository_owner }}
- name: Sync Images
uses: peter-evans/create-or-update-comment@v1
if: ${{ github.repository_owner == env.DEFAULT_OWNER }}
with:
issue-number: 251
repository: labring-actions/cluster-image
body: |
/imagesync ghcr.io/${{ github.repository_owner }}/sealos-cloud-${{ env.MODULE_NAME }}-frontend:${{ steps.prepare.outputs.tag_name }}
token: '${{ secrets.GH_PAT }}'