xmrig 6.21.3
#103
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: dockerbuild | |
on: | |
workflow_dispatch: | |
push: | |
env: | |
IMAGE_NAME: monero_xmrig | |
jobs: | |
build: | |
permissions: | |
packages: write | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Login to Github | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ github.token }} | |
- name: Login to Dockerhub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build Image | |
run: | | |
docker build \ | |
--tag $IMAGE_NAME \ | |
--label org.opencontainers.image.source=https://github.com/${{ github.repository }} \ | |
. | |
- name: Tag and Push | |
run: | | |
GH_IMAGE=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME | |
DH_IMAGE=${{ secrets.DOCKER_USERNAME }}/$IMAGE_NAME | |
# Strip git ref prefix from version | |
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') | |
# Strip "v" prefix from tag name | |
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') | |
# Use Docker `latest` tag convention | |
[ "$VERSION" == "master" ] && VERSION=latest | |
echo Github=$GH_IMAGE | |
echo Dockerhub=$DH_IMAGE | |
echo VERSION=$VERSION | |
docker tag $IMAGE_NAME $GH_IMAGE:$VERSION | |
docker tag $IMAGE_NAME $DH_IMAGE:$VERSION | |
docker push $GH_IMAGE:$VERSION | |
docker push $DH_IMAGE:$VERSION |