Skip to content

Cut v0.13.2 release (#95) #303

Cut v0.13.2 release (#95)

Cut v0.13.2 release (#95) #303

Workflow file for this run

name: main
on:
push:
pull_request:
release:
types: [created]
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.20
uses: actions/setup-go@v1
with:
go-version: 1.20
- uses: actions/setup-python@v4
with:
python-version: '3.8.x'
- uses: azure/setup-helm@v1
with:
version: 'v3.9.0'
id: helm
- name: Check out code into the Go module directory
uses: actions/checkout@v1
- name: Lint, test and build
run: |
# Get tooling
export PATH=$PATH:$(go env GOPATH)/bin
go get
# Lint and test
pip install -r requirements-dev.txt
make generate
make lint
make format
# Exit if after formatting there are any code differences
git diff --exit-code
make test
if [ ${{ github.event_name }} == "release" ]; then
VERSION="${{ github.ref_name }}"
else
VERSION="${{ github.sha }}"
fi
make docker VERSION=${VERSION}
- name: Deploy
env:
DOCKER_USER: ${{ secrets.DOCKER_USER }}
DOCKER_PASS: ${{ secrets.DOCKER_PASS }}
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/master' && github.repository == 'jthomperoo/predictive-horizontal-pod-autoscaler'
run: |
if [ ${{ github.event_name }} == "release" ]; then
VERSION="${{ github.ref_name }}"
else
VERSION="${{ github.sha }}"
fi
echo "$DOCKER_PASS" | docker login --username=$DOCKER_USER --password-stdin
docker push jthomperoo/predictive-horizontal-pod-autoscaler:${VERSION}
if [ ${{ github.event_name }} == "release" ]; then
docker tag jthomperoo/predictive-horizontal-pod-autoscaler:${VERSION} jthomperoo/predictive-horizontal-pod-autoscaler:latest
docker push jthomperoo/predictive-horizontal-pod-autoscaler:latest
fi
- name: Bundle YAML config
if: github.event_name == 'release' && github.ref == 'refs/heads/master' && github.repository == 'jthomperoo/predictive-horizontal-pod-autoscaler'
run: |
# Variables to sub into k8s templates
if [ ${{ github.event_name }} == "release" ]; then
VERSION="${{ github.ref_name }}"
else
VERSION="${{ github.sha }}"
fi
export VERSION="${VERSION}"
sed -i "/version: 0.0.0/c\version: ${VERSION}" helm/Chart.yaml
helm package helm/
- name: Deploy helm package
if: github.event_name == 'release' && github.ref == 'refs/heads/master' && github.repository == 'jthomperoo/predictive-horizontal-pod-autoscaler'
uses: Shopify/upload-to-release@1.0.0
with:
name: predictive-horizontal-pod-autoscaler-${{ github.ref_name }}.tgz
path: predictive-horizontal-pod-autoscaler-${{ github.ref_name }}.tgz
repo-token: ${{ secrets.GITHUB_TOKEN }}