Skip to content

Commit

Permalink
chore: self-hosted
Browse files Browse the repository at this point in the history
  • Loading branch information
kainlite committed Sep 3, 2024
1 parent 783ad7a commit 8c5829b
Showing 1 changed file with 28 additions and 5 deletions.
33 changes: 28 additions & 5 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,41 @@ on:

jobs:
docker:
runs-on: ubuntu-latest
runs-on: self-hosted
steps:
- name: Checkout
uses: actions/checkout@v2

- # Add support for more platforms with QEMU (optional)
# https://github.com/docker/setup-qemu-action
name: Set up QEMU
uses: docker/setup-qemu-action@v3

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

- name: Prepare
id: prep
run: |
DOCKER_IMAGE=docker.io/kainlite/tr-gh
DOCKER_IMAGE=${{ secrets.DOCKER_USERNAME }}/${GITHUB_REPOSITORY#*/}-gh
VERSION=latest
SHORTREF=${GITHUB_SHA::8}
TAG="${DOCKER_IMAGE}:${SHORTREF}"
echo tag=${TAG} >> ${GITHUB_OUTPUT}
# If this is git tag, use the tag name as a docker tag
if [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/v}
fi
TAGS="${DOCKER_IMAGE}:${VERSION},${DOCKER_IMAGE}:${SHORTREF}"
# If the VERSION looks like a version number, assume that
# this is the most recent version of the image and also
# tag it 'latest'.
if [[ $VERSION =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
TAGS="$TAGS,${DOCKER_IMAGE}:latest"
fi
# Set output parameters.
echo tags=${TAGS} >> ${GITHUB_OUTPUT}
- name: Login to Docker Hub
uses: docker/login-action@v3
Expand All @@ -29,4 +52,4 @@ jobs:
uses: docker/build-push-action@v6
with:
push: true
tags: ${{ steps.prep.outputs.tag }}
tags: ${{ steps.prep.outputs.tags }}

0 comments on commit 8c5829b

Please sign in to comment.