Skip to content

Release on Tag

Release on Tag #85

Workflow file for this run

# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
name: Release on Tag
on:
push:
branches: [ "main" ]
release:
types: [ "published" ]
jobs:
build:
if: github.ref_type == 'tag'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.11"]
env:
CI_REGISTRY_IMAGE: "devrelyio/galaxy"
HELM_CHART_REGISTRY_DOMAIN: "registry-1.docker.io"
HELM_CHART_REGISTRY: "oci://${HELM_CHART_REGISTRY_DOMAIN}/devrelyio"
HELM_CHART_PATH: ./deploy/helm/galaxy
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/[email protected]
with:
python-version: ${{ matrix.python-version }}
- name: Setup environment
env:
GITHUB_PATH: ${{ github.path }}
VENV_PATH: "$GITHUB_PATH/.venv"
POETRY_HOME: "$GITHUB_PATH/.poetry"
BIN_PATH: "$GITHUB_PATH/.bin"
run: |
mkdir -p ${VENV_PATH} ${POETRY_HOME} ${BIN_PATH}
export PATH="${VENV_PATH}/bin:${POETRY_HOME}/bin:${BIN_PATH}:$PATH"
export PYTHONUNBUFFERED=1
export PYTHONDONTWRITEBYTECODE=1
export POETRY_VIRTUALENVS_IN_PROJECT=true
export POETRY_VIRTUALENVS_CREATE=true
sudo apt-get update && sudo apt-get install --no-install-recommends -y build-essential curl git
cp /usr/bin/make ${BIN_PATH}
- name: Install dependencies
run: |
make install
- name: Run linter
run: |
make lint
- name: Run tests
run: |
make test
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Docker Login
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_SECRET }}
- name: Build and push docker image
uses: docker/build-push-action@v6
with:
file: deploy/docker/Dockerfile
push: true
cache-from: type=gha
cache-to: type=gha,mode=max
tags: |
${{ env.CI_REGISTRY_IMAGE }}:${{ github.ref_name }}
${{ env.CI_REGISTRY_IMAGE }}:latest
platforms: linux/amd64,linux/arm64
- name: Package and Publish Helm Chart
env:
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
DOCKER_HUB_SECRET: ${{ secrets.DOCKER_HUB_SECRET }}
HELM_CHART_REGISTRY: ${HELM_CHART_REGISTRY}
run: |
sed -i "s+repository.*+repository:\ $CI_REGISTRY_IMAGE+g" $HELM_CHART_PATH/values.yaml
sed -i "s+tag.*+tag:\ $GITHUB_REF_NAME+g" $HELM_CHART_PATH/values.yaml
helm package $HELM_CHART_PATH -d . --version $GITHUB_REF_NAME
HELM_PACKAGE_NAME=$(ls *.tgz)
mkdir -p ./public
helm package $HELM_CHART_PATH --destination ./public --version $GITHUB_REF_NAME
echo $DOCKER_HUB_SECRET | helm registry login "$HELM_CHART_REGISTRY_DOMAIN" -u $DOCKER_HUB_USERNAME --password-stdin
helm push $HELM_PACKAGE_NAME oci://registry-1.docker.io/devrelyio
echo "Helm chart with tag ${GITHUB_REF_NAME} pushed to registry"