Skip to content

build-alb-images-and-chart #144

build-alb-images-and-chart

build-alb-images-and-chart #144

Workflow file for this run

name: build-alb-images-and-chart
on:
workflow_dispatch:
inputs:
skip_test:
type: boolean
description: skil test
required: false
default: false
do_release:
type: boolean
description: do release
required: true
pull_request:
branches:
- master
- release-*
paths-ignore:
- 'docs/**'
- '**.md'
- '.github/VERSION'
push:
branches:
- master
- release-*
paths-ignore:
- 'docs/**'
- '**.md'
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true
env:
GO_VERSION: ''
GOSEC_VERSION: '2.18.2'
HELM_VERSION: v3.13.3
SUBMARINER_VERSION: '0.16.2'
jobs:
build-alb:
name: Build alb
runs-on: ubuntu-22.04
strategy:
matrix:
platform:
- linux/amd64
# - linux/arm64
steps:
- uses: actions/checkout@v4
- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
- name: version # it will set the CURRENT_VERSION env
uses: HardNorth/[email protected]
with:
version-source: file
version-file: ./deploy/chart/alb/Chart.yaml
version-file-extraction-pattern: 'version: v([0-9]*\.[0-9]*\.[0-9]*)'
- uses: docker/setup-buildx-action@v3
- name: test alb go
if: ${{ (matrix.platform == 'linux/amd64' ) && (!inputs.skip_test) }}
env:
MATRIX_PLATFORM: "${{ matrix.platform }}"
run: |
set -x
echo "FROM --platform=\${{ matrix.platform }} | $MATRIX_PLATFORM "
./scripts/run-like-github-actions.sh test-alb-go
- name: build
env:
RELEASE_ME: "${{ github.event.inputs.do_release == 'true' }}"
MATRIX_PLATFORM: "${{matrix.platform }}"
run: |
set -x
./scripts/run-like-github-actions.sh build-alb
platform=$(echo "$MATRIX_PLATFORM" | sed 's|/|-|g')
echo "artifactPath=./alb-$platform.tar" >> $GITHUB_ENV
echo "artifactName=alb-$platform" >> $GITHUB_ENV
- name: Upload alb images to artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.artifactName }}
path: ${{ env.artifactPath }}
- name: test alb nginx
if: ${{ (matrix.platform == 'linux/amd64' ) && (!inputs.skip_test) }}
env:
MATRIX_PLATFORM: "${{matrix.platform }}"
run: |
set -x
./scripts/run-like-github-actions.sh test-alb-nginx
release-alb:
name: Release alb
runs-on: ubuntu-22.04
needs: [build-alb]
steps:
- name: cr
uses: helm/[email protected]
with:
install_only: true
- uses: azure/setup-helm@v3
with:
version: '${{ env.HELM_VERSION }}'
- uses: actions/download-artifact@master
with:
name: alb-linux-amd64
- name: show artifact
run: |
ls -l
- name: pre-release
env:
RELEASE_ME: "${{ github.event.inputs.do_release == 'true' }}"
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
DOCKER_CLI_EXPERIMENTAL: enabled
run: |
branch=$(echo "${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" | sed 's|/|-|g')
echo "pre-release check: $branch $RELEASE_ME"
if [[ "$RELEASE_ME" == "false" ]] && [[ "$branch" == "master" ]] ;then
./scripts/run-like-github-actions.sh pre-release-alb
exit
fi
echo "not pre release"
- name: release
env:
RELEASE_ME: "${{ github.event.inputs.do_release == 'true' }}"
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
DOCKER_CLI_EXPERIMENTAL: enabled
run: |
if [[ "$RELEASE_ME" == "true" ]];then
./scripts/run-like-github-actions.sh release-alb
exit
fi
echo "not release"