flux operator tag and release #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: flux operator tag and release | |
on: | |
workflow_dispatch: | |
inputs: | |
release_tag: | |
description: Custom release tag | |
type: string | |
required: true | |
jobs: | |
build-arm: | |
runs-on: ubuntu-latest | |
name: make and build arm | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Set tag | |
run: | | |
echo "Tag for release is ${{ inputs.release_tag }}" | |
echo "tag=${{ inputs.release_tag }}" >> ${GITHUB_ENV} | |
- uses: actions/setup-go@v3 | |
with: | |
go-version: ^1.20 | |
- name: GHCR Login | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Add custom buildx ARM builder | |
run: | | |
docker buildx create --name armbuilder | |
docker buildx use armbuilder | |
docker buildx inspect --bootstrap | |
- name: Deploy Container | |
env: | |
tag: ${{ env.tag }} | |
run: make arm-deploy ARMIMG=ghcr.io/flux-framework/flux-operator:${tag}-arm | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
command: [docker] | |
name: make and build ${{ matrix.command }} | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- uses: actions/setup-go@v3 | |
with: | |
go-version: ^1.20 | |
- name: Set tag | |
run: | | |
echo "Tag for release is ${{ inputs.release_tag }}" | |
echo "tag=${{ inputs.release_tag }}" >> ${GITHUB_ENV} | |
- name: GHCR Login | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build Container | |
env: | |
tag: ${{ env.tag }} | |
run: | | |
image=ghcr.io/flux-framework/flux-operator-${{ matrix.command }}:v${tag} | |
img=ghcr.io/flux-framework/flux-operator:v${tag} | |
make ${{ matrix.command }}-build BUNDLE_IMG=${image} IMG=${img} CATALOG_IMG=${image} | |
- name: Deploy Container | |
env: | |
tag: ${{ env.tag }} | |
run: | | |
image=ghcr.io/flux-framework/flux-operator-${{ matrix.command }}:v${tag} | |
img=ghcr.io/flux-framework/flux-operator:v${tag} | |
make ${{ matrix.command }}-push BUNDLE_IMG=${image} IMG=${img} CATALOG_IMG=${image} | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- uses: actions/setup-go@v3 | |
with: | |
go-version: ^1.20 | |
- name: Set tag | |
run: | | |
echo "Tag for release is ${{ inputs.release_tag }}" | |
echo "tag=${{ inputs.release_tag }}" >> ${GITHUB_ENV} | |
- name: Install | |
run: conda create --quiet --name fo twine | |
- name: Install dependencies | |
run: | | |
export PATH="/usr/share/miniconda/bin:$PATH" | |
source activate fo | |
pip install setuptools wheel twine | |
- name: Build and publish | |
env: | |
TWINE_USERNAME: ${{ secrets.PYPI_USER }} | |
TWINE_PASSWORD: ${{ secrets.PYPI_PASS }} | |
tag: ${{ env.tag }} | |
run: | | |
export PATH="/usr/share/miniconda/bin:$PATH" | |
source activate fo | |
cd sdk/python/v1alpha2/ | |
pip install -e . | |
python setup.py sdist bdist_wheel | |
cd dist | |
wheelfile=$(ls fluxoperator-*.whl) | |
wheelfile=$(echo "$wheelfile" | sed "s/fluxoperator-//") | |
wheelfile=$(echo "$wheelfile" | sed "s/-py3-none-any.whl//") | |
echo "Release for Python is ${wheelfile}" | |
echo "Release for flux operator is ${tag}" | |
cd ../ | |
if [[ "${wheelfile}" == "${tag}" ]]; then | |
echo "Versions are correct, publishing." | |
twine upload dist/* | |
else | |
echo "Versions are not correct, please fix and upload locally." | |
fi | |
- name: Build release manifests | |
env: | |
tag: ${{ env.tag }} | |
run: | | |
make build-config-arm ARMIMG=ghcr.io/flux-framework/flux-operator:${tag}-arm | |
make build-config IMG=ghcr.io/flux-framework/flux-operator:v${tag} | |
- name: Release Flux Operator | |
uses: softprops/action-gh-release@v1 | |
with: | |
name: Flux Operator Release v${{ env.tag }} | |
tag_name: ${{ env.tag }} | |
generate_release_notes: true | |
files: | | |
examples/dist/flux-operator-arm.yaml | |
examples/dist/flux-operator.yaml | |
env: | |
GITHUB_REPOSITORY: flux-framework/flux-operator |