Skip to content

Bump StackExchange.Redis from 2.7.27 to 2.7.33 #63

Bump StackExchange.Redis from 2.7.27 to 2.7.33

Bump StackExchange.Redis from 2.7.27 to 2.7.33 #63

Workflow file for this run

name: CI
on:
push:
paths:
- 'Source/**/*'
- 'TwitchBot.csproj'
- 'TwitchBot.sln'
- 'Dockerfile'
- '.dockerignore'
- '.github/workflows/*.yml'
branches:
- '**'
tags:
- '*.*.*'
workflow_dispatch:
env:
ARTIFACT_NAME: TwitchBot
DOCKER_IMAGE_NAME: twitchbot
DOCKER_REGISTRY_DOMAIN: ghcr.io
jobs:
build-test:
name: Build & Test
runs-on: ubuntu-22.04
permissions:
contents: read
packages: read
steps:
- name: Clone repository
uses: actions/checkout@v4
- name: Setup .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
- name: Add GitHub Packages source
run: dotnet nuget add source --name github --username ${{ github.repository_owner }} --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json"
- name: Restore dependencies
run: dotnet restore
- name: Build project
run: dotnet build --nologo --configuration Release --no-restore
- name: Run tests
run: dotnet test --nologo --configuration Release --no-build
- name: Upload build artifact
uses: actions/upload-artifact@v3
with:
name: ${{ env.ARTIFACT_NAME }}
path: bin/Release/net7.0/*
docker:
name: Docker
runs-on: ubuntu-22.04
needs: build-test
permissions:
contents: read
packages: write
steps:
- name: Clone repository
uses: actions/checkout@v4
- name: Setup QEMU
uses: docker/setup-qemu-action@v3
- name: Setup Docker
uses: docker/setup-buildx-action@v3
with:
platforms: linux/amd64
- name: Login to GitHub Container Registry
if: ${{ github.event_name != 'pull_request' && !startsWith( github.ref_name, 'dependabot/' ) }}
uses: docker/login-action@v3
with:
registry: ${{ env.DOCKER_REGISTRY_DOMAIN }}
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Download build artifact
uses: actions/download-artifact@v3
with:
name: ${{ env.ARTIFACT_NAME }}
path: artifact
- name: Create metadata for Docker image
id: metadata
uses: docker/metadata-action@v5
with:
images: ${{ env.DOCKER_REGISTRY_DOMAIN }}/${{ github.repository_owner }}/${{ env.DOCKER_IMAGE_NAME }}
flavor: latest=true
tags: |
type=ref,event=branch
type=semver,pattern={{major}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}.{{minor}}.{{patch}}
labels: |
org.opencontainers.image.title=Twitch Bot
org.opencontainers.image.description=My Twitch integration & chat bot.
com.docker.extension.publisher-url=https://viral32111.com
- name: Build & push Docker image
uses: docker/build-push-action@v5
with:
push: ${{ github.event_name != 'pull_request' && !startsWith( github.ref_name, 'dependabot/' ) }}
file: Dockerfile
context: artifact
tags: ${{ steps.metadata.outputs.tags }}
labels: ${{ steps.metadata.outputs.labels }}
platforms: linux/amd64
provenance: false
no-cache: true
pull: true
- name: Delete old Docker images
if: ${{ github.event_name != 'pull_request' && !startsWith( github.ref_name, 'dependabot/' ) }}
continue-on-error: true
uses: snok/container-retention-policy@v2
with:
image-names: ${{ env.DOCKER_IMAGE_NAME }}
cut-off: 24 hours ago UTC
keep-at-least: 1
untagged-only: true
skip-tags: latest
account-type: personal
token: ${{ secrets.PERSONAL_ACCESS_TOKEN_PACKAGES }}
release:
name: Release
runs-on: ubuntu-22.04
needs: docker
if: ${{ github.event_name == 'push' && github.ref_type == 'tag' }}
permissions:
contents: write
steps:
- name: Clone repository
uses: actions/checkout@v4
- name: Download build artifact
uses: actions/download-artifact@v3
with:
name: ${{ env.ARTIFACT_NAME }}
path: artifact
- name: Bundle build artifact
run: zip -r ${{ env.ARTIFACT_NAME }}.zip artifact
- name: Create draft release
uses: softprops/action-gh-release@v2
with:
draft: true
tag_name: ${{ github.ref_name }}
files: ${{ env.ARTIFACT_NAME }}.zip
token: ${{ secrets.GITHUB_TOKEN }}