From 4841c07838984c6e91c7fdb3e742f62204267cc1 Mon Sep 17 00:00:00 2001 From: Max Isom Date: Sat, 17 Aug 2024 17:02:40 -0700 Subject: [PATCH] Update Docker builds to publish to ghcr.io & update README --- .github/workflows/pr.yml | 49 ++++++++++++------------- .github/workflows/publish.yml | 68 ++++++++++++++++++++++------------- README.md | 16 +++++---- package.json | 2 +- src/events/guild-create.ts | 2 +- 5 files changed, 77 insertions(+), 60 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 7c611ac1..aee9ab5f 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -9,38 +9,30 @@ jobs: matrix: runner-platform: - ubuntu-latest - - buildjet-4vcpu-ubuntu-2204-arm + - macos-14 # ARM include: - runner-platform: ubuntu-latest build-arch: linux/amd64 tagged-platform: amd64 - - runner-platform: buildjet-4vcpu-ubuntu-2204-arm + - runner-platform: macos-14 build-arch: linux/arm64 tagged-platform: arm64 runs-on: ${{ matrix.runner-platform }} + permissions: + contents: read + packages: write + attestations: write + id-token: write steps: - name: Set up Buildx uses: docker/setup-buildx-action@v1 - - name: Cache Docker layers - # AWS data transfer is pricy - if: ${{ matrix.runner-platform != 'buildjet-4vcpu-ubuntu-2204-arm' }} - uses: actions/cache@v2 + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 with: - path: /tmp/.buildx-cache - key: ${{ runner.os }}-buildx-prs-${{ matrix.build-arch }}-${{ github.event.pull_request.head.sha }} - restore-keys: | - ${{ runner.os }}-buildx-prs-${{ matrix.build-arch }} - - - name: Login to DockerHub - uses: docker/login-action@v1 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - uses: actions/checkout@v2 - with: - ref: ${{ github.event.pull_request.head.sha }} + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} - name: Get current time uses: josStorer/get-current-time@v2 @@ -48,13 +40,11 @@ jobs: - name: Build and push id: docker_build - uses: docker/build-push-action@v2 + uses: docker/build-push-action@v6 with: context: . push: true - tags: codetheweb/muse:${{ github.event.pull_request.head.sha }}-${{ matrix.tagged-platform }} - cache-from: type=local,src=/tmp/.buildx-cache - cache-to: type=local,dest=/tmp/.buildx-cache,mode=min + tags: ghcr.io/museofficial/muse:${{ github.event.pull_request.head.sha }}-${{ matrix.tagged-platform }} platforms: ${{ matrix.build-arch }} build-args: | COMMIT_HASH=${{ github.sha }} @@ -74,8 +64,15 @@ jobs: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Combine tags - run: docker buildx imagetools create -t 'codetheweb/muse:pr-${{ github.event.number }}' -t 'codetheweb/muse:${{ github.event.pull_request.head.sha }}' 'codetheweb/muse:${{ github.event.pull_request.head.sha }}-arm64' 'codetheweb/muse:${{ github.event.pull_request.head.sha }}-amd64' + run: docker buildx imagetools create -t 'ghcr.io/museofficial/muse:pr-${{ github.event.number }}' -t 'ghcr.io/museofficial/muse:${{ github.event.pull_request.head.sha }}' 'ghcr.io/museofficial/muse:${{ github.event.pull_request.head.sha }}-arm64' 'ghcr.io/museofficial/muse:${{ github.event.pull_request.head.sha }}-amd64' - name: Create comment uses: marocchino/sticky-pull-request-comment@v2 @@ -84,7 +81,7 @@ jobs: message: | #### :package: A new release has been made for this pull request. - To play around with this PR, pull `codetheweb/muse:pr-${{ github.event.number }}` or `codetheweb/muse:${{ github.event.pull_request.head.sha }}`. + To play around with this PR, pull `ghcr.io/museofficial/muse:pr-${{ github.event.number }}` or `ghcr.io/museofficial/muse:${{ github.event.pull_request.head.sha }}`. Images are available for x86_64 and ARM64. diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 08acff9e..739db245 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -11,28 +11,23 @@ jobs: matrix: runner-platform: - ubuntu-latest - - buildjet-4vcpu-ubuntu-2204-arm + - macos-14 # ARM include: - runner-platform: ubuntu-latest build-arch: linux/amd64 tagged-platform: amd64 - - runner-platform: buildjet-4vcpu-ubuntu-2204-arm + - runner-platform: macos-14 build-arch: linux/arm64 tagged-platform: arm64 runs-on: ${{ matrix.runner-platform }} + permissions: + contents: read + packages: write + attestations: write + id-token: write steps: - name: Set up Buildx - uses: docker/setup-buildx-action@v1 - - - name: Cache Docker layers - # AWS data transfer is pricy - if: ${{ matrix.runner-platform != 'buildjet-4vcpu-ubuntu-2204-arm' }} - uses: actions/cache@v2 - with: - path: /tmp/.buildx-cache - key: ${{ runner.os }}-buildx-prs-${{ matrix.build-arch }}-${{ github.sha }} - restore-keys: | - ${{ runner.os }}-buildx-prs-${{ matrix.build-arch }} + uses: docker/setup-buildx-action@v3 - name: Login to DockerHub uses: docker/login-action@v1 @@ -40,19 +35,26 @@ jobs: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Get current time uses: josStorer/get-current-time@v2 id: current-time - name: Build and push id: docker_build - uses: docker/build-push-action@v2 + uses: docker/build-push-action@v6 with: push: true - tags: codetheweb/muse:${{ github.sha }}-${{ matrix.tagged-platform }} + tags: | + codetheweb/muse:${{ github.sha }}-${{ matrix.tagged-platform }} + ghcr.io/museofficial/muse:${{ github.sha }}-${{ matrix.tagged-platform }} platforms: ${{ matrix.build-arch }} - cache-from: type=local,src=/tmp/.buildx-cache - cache-to: type=local,dest=/tmp/.buildx-cache,mode=min build-args: | COMMIT_HASH=${{ github.sha }} BUILD_DATE=${{ steps.current-time.outputs.time }} @@ -73,21 +75,37 @@ jobs: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Get tags - id: get-tags + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Get tags (Docker Hub) + id: get-tags-dockerhub uses: Surgo/docker-smart-tag-action@v1 with: docker_image: codetheweb/muse - - name: Combine tags - run: docker buildx imagetools create $(echo '${{ steps.get-tags.outputs.tag }}' | tr "," "\0" | xargs -0 printf -- '-t %s ') 'codetheweb/muse:${{ github.sha }}-arm64' 'codetheweb/muse:${{ github.sha }}-amd64' + - name: Get tags (ghcr.io) + id: get-tags-ghcr + uses: Surgo/docker-smart-tag-action@v1 + with: + docker_image: codetheweb/muse + + - name: Combine tags (Docker Hub) + run: docker buildx imagetools create $(echo '${{ steps.get-tags-dockerhub.outputs.tag }}' | tr "," "\0" | xargs -0 printf -- '-t %s ') 'codetheweb/muse:${{ github.sha }}-arm64' 'codetheweb/muse:${{ github.sha }}-amd64' + + - name: Combine tags (GitHub Container Registry) + run: docker buildx imagetools create $(echo '${{ steps.get-tags-ghcr.outputs.tag }}' | tr "," "\0" | xargs -0 printf -- '-t %s ') 'ghcr.io/museofficial/muse:${{ github.sha }}-arm64' 'ghcr.io/museofficial/muse:${{ github.sha }}-amd64' - name: Update Docker Hub description uses: peter-evans/dockerhub-description@v2.4.3 - env: - DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} - DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }} - DOCKERHUB_REPOSITORY: codetheweb/muse + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_PASSWORD }} + repository: codetheweb/muse release: name: Create GitHub release diff --git a/README.md b/README.md index 0538183c..db4e842a 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,10 @@

- +

-**🔎 I'm currently looking for maintainers.** Check out [this issue](https://github.com/codetheweb/muse/issues/1063) for details. +> [!WARNING] +> @codetheweb (me) is no longer the primary maintainer of Muse. **If you use the Docker image, update your image source to `ghcr.io/museofficial/muse`.** We are currently publishing new releases to both `ghcr.io/museofficial/muse` and `codetheweb/muse`, but this may change in the future. +> Thank you to all the people who stepped up to help maintain Muse! ------ @@ -42,7 +44,7 @@ A 64-bit OS is required to run Muse. The `master` branch acts as the developing / bleeding edge branch and is not guaranteed to be stable. -When running a production instance, I recommend that you use the [latest release](https://github.com/codetheweb/muse/releases/). +When running a production instance, I recommend that you use the [latest release](https://github.com/museofficial/muse/releases/). ### 🐳 Docker @@ -56,7 +58,7 @@ There are a variety of image tags available: (Replace empty config strings with correct values.) ```bash -docker run -it -v "$(pwd)/data":/data -e DISCORD_TOKEN='' -e SPOTIFY_CLIENT_ID='' -e SPOTIFY_CLIENT_SECRET='' -e YOUTUBE_API_KEY='' codetheweb/muse:latest +docker run -it -v "$(pwd)/data":/data -e DISCORD_TOKEN='' -e SPOTIFY_CLIENT_ID='' -e SPOTIFY_CLIENT_SECRET='' -e YOUTUBE_API_KEY='' ghcr.io/museofficial/muse:latest ``` This starts Muse and creates a data directory in your current directory. @@ -68,7 +70,7 @@ version: '3.4' services: muse: - image: codetheweb/muse:latest + image: ghcr.io/museofficial/muse:latest restart: always volumes: - ./muse:/data @@ -85,13 +87,13 @@ services: * Node.js (18.17.0 or later is required and latest 18.x.x LTS is recommended) * ffmpeg (4.1 or later) -1. `git clone https://github.com/codetheweb/muse.git && cd muse` +1. `git clone https://github.com/museofficial/muse.git && cd muse` 2. Copy `.env.example` to `.env` and populate with values 3. I recommend checking out a tagged release with `git checkout v[latest release]` 4. `yarn install` (or `npm i`) 5. `yarn start` (or `npm run start`) -**Note**: if you're on Windows, you may need to manually set the ffmpeg path. See [#345](https://github.com/codetheweb/muse/issues/345) for details. +**Note**: if you're on Windows, you may need to manually set the ffmpeg path. See [#345](https://github.com/museofficial/muse/issues/345) for details. ## ⚙️ Additional configuration (advanced) diff --git a/package.json b/package.json index ae5aecf1..0d8631e8 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "muse", "version": "2.9.1", "description": "🎧 a self-hosted Discord music bot that doesn't suck ", - "repository": "git@github.com:codetheweb/muse.git", + "repository": "git@github.com:museofficial/muse.git", "author": "Max Isom ", "license": "MIT", "private": true, diff --git a/src/events/guild-create.ts b/src/events/guild-create.ts index 1d609105..c903009a 100644 --- a/src/events/guild-create.ts +++ b/src/events/guild-create.ts @@ -40,5 +40,5 @@ export default async (guild: Guild): Promise => { } const owner = await guild.fetchOwner(); - await owner.send('👋 Hi! Someone (probably you) just invited me to a server you own. By default, I\'m usable by all guild member in all guild channels. To change this, check out the wiki page on permissions: https://github.com/codetheweb/muse/wiki/Configuring-Bot-Permissions.'); + await owner.send('👋 Hi! Someone (probably you) just invited me to a server you own. By default, I\'m usable by all guild member in all guild channels. To change this, check out the wiki page on permissions: https://github.com/museofficial/muse/wiki/Configuring-Bot-Permissions.'); };