Add updated genesis workflow file #3
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: 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 }} |