Skip to content

feat: Fully implement DEBUG_MODE #137

feat: Fully implement DEBUG_MODE

feat: Fully implement DEBUG_MODE #137

Workflow file for this run

name: PR Workflow
on:
pull_request_target:
types:
- labeled
- synchronize
- reopened
- opened
branches:
- 'master'
jobs:
test:
if: contains(github.event.pull_request.labels.*.name, 'safe to test')
uses: ./.github/workflows/testAndSanity.yml
with:
ref: ${{ github.event.pull_request.head.sha }}
release-snapshot:
name: Release snapshot
runs-on: ubuntu-latest
needs: test
if: contains(github.event.pull_request.labels.*.name, 'safe to test')
permissions:
packages: write
contents: read
strategy:
fail-fast: false
matrix:
include:
- dockerfile: ./Dockerfile
suffix: ''
platforms: 'linux/amd64,linux/arm64'
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: |
foxxmd/multi-scrobbler
ghcr.io/foxxmd/multi-scrobbler
tags: |
type=ref,event=pr,suffix=${{ matrix.suffix }}
flavor: |
latest=false
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Set short git commit SHA
run: |
short=$(echo "${{ github.event.pull_request.head.sha }}" | head -c7)
echo "COMMIT_SHORT_SHA=$short" >> $GITHUB_ENV
- name: Build and push
id: docker_build
uses: docker/build-push-action@v5
env:
APP_VERSION: ${{ format('pr{0}-{1}', github.event.number, env.COMMIT_SHORT_SHA ) }}
with:
context: .
build-args: |
APP_BUILD_VERSION=${{env.APP_VERSION}}
file: ${{ matrix.dockerfile }}
push: ${{ !env.ACT}}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: ${{ matrix.platforms }}
combine-and-comment:
name: Leave comment
runs-on: ubuntu-latest
needs: release-snapshot
if: contains(github.event.pull_request.labels.*.name, 'safe to test')
steps:
- name: Create comment
uses: marocchino/sticky-pull-request-comment@v2
with:
recreate: true
header: "pr-release"
message: |
#### :package: A new release has been made for this pull request.
To play around with this PR, pull an image:
* `foxxmd/multi-scrobbler:pr-${{ github.event.number }}`
Images are available for x86_64 and ARM64.
> Latest commit: ${{ github.event.pull_request.head.sha }}