Skip to content

Publish xmrig-proxy #205

Publish xmrig-proxy

Publish xmrig-proxy #205

name: Publish xmrig-proxy
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
on: # yamllint disable-line rule:truthy
schedule:
- cron: '5 4 * * 6'
push:
branches: ["main"]
# Publish semver tags as releases.
tags: ["v*.*.*"]
paths: ["xmrig-proxy/**"]
pull_request:
branches: ["main"]
paths: ["xmrig-proxy/**"]
env:
IMAGE_NAME: xmrig-proxy
IMAGE_VERSION: 6.21.1
GHCR_REGISTRY: ghcr.io
GHCR_USER: ${{ github.repository_owner }}
GHCR_IMAGE: ${GHCR_REGISTRY}/${GHCR_USER}/${IMAGE_NAME}
# DOCKERHUB_REGISTRY=docker.io
# DOCKERHUB_USER: ${{ github.repository_owner }}
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4.1.7
- name: Prepare
id: prep
run: |
#VERSION=${GITHUB_REF#refs/tags/v}
VERSION=${{ env.IMAGE_VERSION }}
MINOR=${VERSION%.*}
MAJOR=${VERSION%%.*}
GHCR_IMAGE=${{ env.GHCR_IMAGE }}
#TAGS="${DOCKERHUB_IMAGE}:${MAJOR},${DOCKERHUB_IMAGE}:${MINOR}"
#TAGS="${TAGS},${DOCKERHUB_IMAGE}:${VERSION},${DOCKERHUB_IMAGE}:latest"
TAGS="${TAGS},${GHCR_IMAGE}:${MAJOR},${GHCR_IMAGE}:${MINOR}"
TAGS="${TAGS},${GHCR_IMAGE}:${VERSION},${GHCR_IMAGE}:latest"
echo ::set-output name=name::${{ env.IMAGE_NAME }}
echo ::set-output name=tags::${TAGS}
echo ::set-output name=version::${VERSION}
#echo ::set-output name=dockerhub_image::${DOCKERHUB_IMAGE}
echo ::set-output name=ghcr_image::${GHCR_IMAGE}
# https://github.com/docker/login-action
- name: Log into GitHub Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567
with:
registry: ${{ env.GHCR_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# https://github.com/docker/build-push-action
- name: Build and push
uses: docker/build-push-action@16ebe778df0e7752d2cfcbd924afdbbd89c1a755
with:
context: ${{ steps.prep.outputs.name }}
file: ${{ steps.prep.outputs.name }}/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.prep.outputs.tags }}
labels: org.opencontainers.image.version=${{ steps.prep.outputs.version }}