Skip to content

Add updated genesis workflow file #3

Add updated genesis workflow file

Add updated genesis workflow file #3

Workflow file for this run

name: status-cake-exporter
on:
push:
tags:
- v*
pull_request:
branches:
- main
env:
IMAGE_NAME: status-cake-exporter
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python 🐍
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install Dependencies 🚧
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt
- name: Lint 🍻
run: |
python -m flake8 exporter/ --max-line-length=120 --tee
# - name: Test βœ…
# run: |
# python setup.py test
- name: Build image 🐳
run: docker build . --file Dockerfile --tag status-cake-exporter
- name: Log into registry 🐳
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Push image 🐳
run: |
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
if [[ "${{ github.ref }}" == "refs/tags/v"* ]]; then
docker tag $IMAGE_NAME $IMAGE_ID:$(echo $VERSION | sed -e 's/^v//')
# latest should always reflect the most recent tagged release
VERSION=latest
elif [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
# main represents the latest build from main branch
VERSION=main
else
# dev represents the latest build from prs or branches
VERSION=dev
fi
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
docker push -a $IMAGE_ID
env:
GITVERSION_MAJORMINORPATCH: ${{ steps.gitversion.outputs.majorMinorPatch }}
- name: Build Changelog πŸ“
if: startsWith(github.ref, 'refs/tags/v')
id: build_changelog
uses: mikepenz/release-changelog-builder-action@v1
with:
configuration: "changelog.json"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Release πŸš€
if: startsWith(github.ref, 'refs/tags/v')
id: create_release
uses: ncipollo/release-action@v1
with:
name: status-cake-exporter
body: ${{steps.build_changelog.outputs.changelog}}
token: ${{ secrets.GITHUB_TOKEN }}