PSF-LoginServer/.github/workflows/test-server-command.yml
2024-10-06 23:08:52 +01:00

37 lines
1.3 KiB
YAML

name: Publish PR Docker Image
on:
repository_dispatch:
types: [test-server-command]
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Dump the client payload context
env:
PAYLOAD_CONTEXT: ${{ toJson(github.event.client_payload) }}
run: echo "$PAYLOAD_CONTEXT"
- name: Checkout
uses: actions/checkout@v2
with:
ref: ${{ github.event.client_payload.pull_request.head.sha }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Set variables
id: prep
run: |
DOCKER_IMAGE=test-server
REPOSITORY="$(echo $GITHUB_REPOSITORY | tr '[:upper:]' '[:lower:]')" # Repository name must be lowercase in image tags
TAGS="ghcr.io/${REPOSITORY}/${DOCKER_IMAGE}:${{ github.event.client_payload.pull_request.head.sha }}"
echo ::set-output name=tags::${TAGS}
- name: Log in to GitHub Docker Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build container image
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ${{ steps.prep.outputs.tags }} #