Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
bnfone committed Aug 22, 2024
2 parents bdcf38c + 59c278f commit 9748f51
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 84 deletions.
135 changes: 75 additions & 60 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -1,60 +1,75 @@
name: Docker Hub

on:
release:
types: [published]

env:
# Use docker.io for Docker Hub if empty
REGISTRY: docker.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v2
# QEMU for emulation
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
# Docker Buildx for creating multi arch docker images
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

# Login against a Docker registry when not a PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v3
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
platforms: linux/amd64,linux/arm64,linux/arm/v7
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
name: Docker Hub

on:
pull_request:
branches: [ main, master ]
push:
branches: [ main, master ]
release:
types: [published]

env:
REGISTRY: docker.io
IMAGE_NAME: ${{ github.repository }}

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Log into registry ${{ env.REGISTRY }}
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64,linux/arm64,linux/arm/v7
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- name: Tag as latest for releases
if: github.event_name == 'release'
env:
DOCKER_CLI_ABI: "1.42"
run: |
docker buildx imagetools create -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest ${{ steps.meta.outputs.tags }}
- name: Tag as experimental for pull requests
if: github.event_name == 'pull_request'
env:
DOCKER_CLI_ABI: "1.42"
run: |
docker buildx imagetools create -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:experimental ${{ steps.meta.outputs.tags }}
- name: Image digest
run: echo ${{ steps.build-and-push.outputs.digest }}
42 changes: 21 additions & 21 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"string-progressbar": "^1.0.4",
"tar": "^6.2.1",
"ws": "^8.18.0",
"youtube-dl-exec": "^3.0.2",
"youtube-dl-exec": "^3.0.7",
"youtube-sr": "^4.3.11"
},
"devDependencies": {
Expand All @@ -44,13 +44,13 @@
"@types/tough-cookie": "^4.0.5",
"braces": "^3.0.3",
"cz-conventional-changelog": "^3.0.1",
"nodemon": "^3.1.3",
"nodemon": "^3.1.4",
"prettier": "^3.2.5",
"ts-node": "^10.9.2"
},
"optionalDependencies": {
"@discordjs/opus": "^0.9.0",
"libsodium-wrappers": "^0.7.13",
"libsodium-wrappers": "^0.7.15",
"opusscript": "^0.1.1",
"sodium-native": "^4.1.1",
"tweetnacl": "^1.0.3"
Expand Down

0 comments on commit 9748f51

Please sign in to comment.