Skip to content

Fix/release bump

Fix/release bump #37

Workflow file for this run

name: Build and publish image
on:
workflow_dispatch:
pull_request:
push:
branches: ["main"]
paths:
- bot/src/**
- Dockerfile
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
env:
WORKING_DIRECTORY: 'bot'
defaults:
run:
working-directory: ./bot
jobs:
build:
name: Build and publish image
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up NodeJS
uses: actions/setup-node@v3
with:
node-version: 18.17
- name: Install dependencies
run: npm ci
- name: Log in to Docker Hub
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/[email protected]
with:
images: ${{ github.repository }}
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=ref,event=pr
- name: Build and push Docker image
uses: docker/[email protected]
with:
context: ./${{ env.WORKING_DIRECTORY }}
file: ./${{ env.WORKING_DIRECTORY }}/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Notify on failure
if: ${{ failure() }}
env:
DISCORD_MESSAGE: "Workflow failed at: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
run: |
curl -H "Content-Type: application/json" \
-d '{"username": "${{ github.repository }}/${{ github.workflow }}", "content": "${{ env.DISCORD_MESSAGE }}"}' \
"${{ secrets.DISCORD_ALERTS_WEBHOOK }}"