Bump eslint from 8.50.0 to 8.52.0 #170
Workflow file for this run
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: CI | |
on: | |
push: | |
paths: | |
- '**' | |
branches: | |
- '**' | |
tags: | |
- '*.*.*' | |
workflow_dispatch: | |
env: | |
ARTIFACT_NAME: Discord-Conversation-Bot | |
DOCKER_IMAGE_NAME: discord-conversation-bot | |
DOCKER_REGISTRY_DOMAIN: ghcr.io | |
# ghcr.io/viral32111/discord-conversation-bot:latest | |
# ghcr.io/viral32111/discord-conversation-bot:latest-ubuntu-amd64 | |
# ghcr.io/viral32111/discord-conversation-bot:latest-windows-amd64 | |
# ghcr.io/viral32111/discord-conversation-bot:main | |
# ghcr.io/viral32111/discord-conversation-bot:main-ubuntu-amd64 | |
# ghcr.io/viral32111/discord-conversation-bot:main-windows-amd64 | |
# ghcr.io/viral32111/discord-conversation-bot:1.0.0 | |
# ghcr.io/viral32111/discord-conversation-bot:1.0.0-ubuntu-amd64 | |
# ghcr.io/viral32111/discord-conversation-bot:1.0.0-windows-amd64 | |
# ghcr.io/viral32111/discord-conversation-bot:1.0 | |
# ghcr.io/viral32111/discord-conversation-bot:1.0-ubuntu-amd64 | |
# ghcr.io/viral32111/discord-conversation-bot:1.0-windows-amd64 | |
# ghcr.io/viral32111/discord-conversation-bot:1 | |
# ghcr.io/viral32111/discord-conversation-bot:1-ubuntu-amd64 | |
# ghcr.io/viral32111/discord-conversation-bot:1-windows-amd64 | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-22.04 | |
permissions: | |
contents: read | |
steps: | |
- name: Clone repository | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Install dependencies | |
run: npm clean-install | |
- name: Lint | |
run: npx eslint | |
- name: Build | |
run: npx tsc | |
- name: Upload build artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ env.ARTIFACT_NAME }} | |
path: | | |
dist/ | |
package.json | |
package-lock.json | |
docker: | |
name: Docker | |
runs-on: ${{ matrix.runner }} | |
needs: build | |
strategy: | |
matrix: | |
name: [ 'Ubuntu', 'Windows' ] | |
include: | |
- name: Ubuntu | |
runner: ubuntu-22.04 | |
dockerfile: ubuntu.dockerfile | |
platform: linux | |
architecture: amd64 | |
suffix: ubuntu | |
- name: Windows | |
runner: windows-2022 | |
dockerfile: windows.dockerfile | |
platform: windows | |
architecture: amd64 | |
suffix: windows | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Clone repository | |
uses: actions/checkout@v4 | |
- name: Setup Docker | |
uses: docker/setup-buildx-action@v3 | |
with: | |
platforms: ${{ matrix.platform }}/${{ matrix.architecture }} | |
- name: Login to GitHub Container Registry | |
if: ${{ github.event_name != 'pull_request' && !startsWith( github.ref_name, 'dependabot/' ) }} | |
uses: docker/#-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 | |
suffix=-${{ matrix.suffix }}-${{ matrix.architecture }},onlatest=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=Discord Conversation Bot | |
org.opencontainers.image.vendor=${{ github.repository_owner }} | |
com.docker.extension.publisher-url=https://viral32111.com | |
- name: Format metadata for Docker image (Windows) | |
id: format | |
if: ${{ matrix.name == 'Windows' }} | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
const { DOCKER_METADATA_OUTPUT_JSON } = process.env; | |
const { tags, labels } = JSON.parse( DOCKER_METADATA_OUTPUT_JSON ); | |
core.setOutput( "tags", "--tag " + tags.join( " --tag " ) ); | |
core.setOutput( "labels", "--label " + Object.entries( labels ).map( label => label[ 0 ] + "=\"" + label[ 1 ] + "\"" ).join( " --label " ) ); | |
- name: Build & push Docker image (Ubuntu) | |
if: ${{ matrix.name == 'Ubuntu' }} | |
uses: docker/build-push-action@v5 | |
with: | |
push: ${{ github.event_name != 'pull_request' && !startsWith( github.ref_name, 'dependabot/' ) }} | |
file: ${{ matrix.dockerfile }} | |
context: artifact | |
tags: ${{ steps.metadata.outputs.tags }} | |
labels: ${{ steps.metadata.outputs.labels }} | |
platforms: ${{ matrix.platform }}/${{ matrix.architecture }} | |
provenance: false | |
no-cache: true | |
pull: true | |
- name: Build Docker image (Windows) | |
if: ${{ matrix.name == 'Windows' }} | |
run: docker image build --no-cache --pull --file ${{ matrix.dockerfile }} ${{ steps.format.outputs.tags }} ${{ steps.format.outputs.labels }} artifact | |
- name: Push Docker image (Windows) | |
if: ${{ matrix.name == 'Windows' && github.event_name != 'pull_request' && !startsWith( github.ref_name, 'dependabot/' ) }} | |
run: docker image push --all-tags ${{ env.DOCKER_REGISTRY_DOMAIN }}/${{ github.repository_owner }}/${{ env.DOCKER_IMAGE_NAME }} | |
maintenance: | |
name: Maintenance | |
runs-on: ubuntu-22.04 | |
needs: docker | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Clone repository | |
uses: actions/checkout@v4 | |
- name: Setup Docker | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GitHub Container Registry | |
if: ${{ github.event_name != 'pull_request' && !startsWith( github.ref_name, 'dependabot/' ) }} | |
uses: docker/#-action@v3 | |
with: | |
registry: ${{ env.DOCKER_REGISTRY_DOMAIN }} | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create Docker image manifest | |
run: | | |
docker manifest create ${{ env.DOCKER_REGISTRY_DOMAIN }}/${{ github.repository_owner }}/${{ env.DOCKER_IMAGE_NAME }}:latest \ | |
--amend ${{ env.DOCKER_REGISTRY_DOMAIN }}/${{ github.repository_owner }}/${{ env.DOCKER_IMAGE_NAME }}:latest-ubuntu-amd64 \ | |
--amend ${{ env.DOCKER_REGISTRY_DOMAIN }}/${{ github.repository_owner }}/${{ env.DOCKER_IMAGE_NAME }}:latest-windows-amd64 | |
docker manifest annotate --os linux --arch amd64 \ | |
${{ env.DOCKER_REGISTRY_DOMAIN }}/${{ github.repository_owner }}/${{ env.DOCKER_IMAGE_NAME }}:latest \ | |
${{ env.DOCKER_REGISTRY_DOMAIN }}/${{ github.repository_owner }}/${{ env.DOCKER_IMAGE_NAME }}:latest-ubuntu-amd64 | |
docker manifest annotate --os windows --arch amd64 \ | |
${{ env.DOCKER_REGISTRY_DOMAIN }}/${{ github.repository_owner }}/${{ env.DOCKER_IMAGE_NAME }}:latest \ | |
${{ env.DOCKER_REGISTRY_DOMAIN }}/${{ github.repository_owner }}/${{ env.DOCKER_IMAGE_NAME }}:latest-windows-amd64 | |
- name: Push Docker image manifest | |
if: ${{ github.event_name != 'pull_request' && !startsWith( github.ref_name, 'dependabot/' ) }} | |
run: docker manifest push ${{ env.DOCKER_REGISTRY_DOMAIN }}/${{ github.repository_owner }}/${{ env.DOCKER_IMAGE_NAME }}:latest | |
- name: Delete old Docker images | |
if: ${{ github.event_name != 'pull_request' && !startsWith( github.ref_name, 'dependabot/' ) }} | |
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: maintenance | |
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@v1 | |
with: | |
draft: true | |
tag_name: ${{ github.ref_name }} | |
files: ${{ env.ARTIFACT_NAME }}.zip | |
token: ${{ secrets.GITHUB_TOKEN }} |