Skip to content

Bump black from 23.3.0 to 24.4.2 #381

Bump black from 23.3.0 to 24.4.2

Bump black from 23.3.0 to 24.4.2 #381

name: Docker
on:
push:
# Publish `master` as Docker `latest` image
# and `dev` as Docker `dev` image.
branches:
- main
- dev
# Publish `v1.2.3` tags as releases.
tags:
- v*
# Run tests for any PRs.
pull_request:
#env:
# TODO: Change variable to your image's name.
#IMAGE_NAME: jassa-bot
jobs:
# gitleaks:
# if: github.event_name == 'pull_request'
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# # - name: Check for any exposed keys
# - uses: zricethezav/gitleaks-action@v2
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Run tests.
# See also https://docs.docker.com/docker-hub/builds/automated-testing/
# TODO: Add actual testing
# test:
# # If gitleaks fails stop workflow
# # TODO: Make it so a push doesn't fail entire workflow
# #needs: gitleaks
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - uses: satackey/action-docker-layer-caching@v0.0.11
# continue-on-error: true
# - name: Run tests
# run: docker build . --file Dockerfile
# Push image to GitHub Packages.
# See also https://docs.docker.com/docker-hub/builds/
push:
# Ensure test job passes before pushing image.
# needs: test
runs-on: ubuntu-latest
# Don't push docker image on PRs
if: github.event_name == 'push'
steps:
- uses: actions/checkout@v4
- uses: jpribyl/action-docker-layer-caching@v0.1.1
continue-on-error: true
- name: Build image
run: docker build . --file Dockerfile --tag jassa-bot --progress=plain
- name: Log into Dockerhub
run: echo "${{ secrets.DOCKERHUB_PASSWORD }}" | docker login -u jorgen1040 --password-stdin
- name: Push image to Dockerhub
run: |
IMAGE_ID=${{ github.repository_owner }}/jassa-bot
# Change all uppercase to lowercase
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
# Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# Strip "v" prefix from tag name
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
# Use Docker `latest` tag convention
[ "$VERSION" == "main" ] && VERSION=latest
[ "$VERSION" == "dev"] && VERSION=dev
echo IMAGE_ID=$IMAGE_ID
echo VERSION=$VERSION
docker tag jassa-bot $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION