run on self-hosted #1
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: Publish DockerHub | |
# yamllint disable-line rule:truthy | |
on: | |
push: | |
branches: [master] | |
tags: | |
- "[0-9]+.[0-9]+.[0-9]+" | |
jobs: | |
check-secrets: | |
runs-on: self-hosted | |
outputs: | |
available: ${{ steps.secrets.outputs.defined }} | |
steps: | |
- id: secrets | |
if: ${{ env.DOCKERHUB_TOKEN != '' }} | |
run: echo "defined=true" >> $GITHUB_OUTPUT | |
env: | |
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} | |
build: | |
runs-on: self-hosted | |
needs: [check-secrets] | |
if: needs.check-secrets.outputs.available == 'true' | |
steps: | |
- name: Checkout code | |
uses: actions/[email protected] | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Login to DockerHUB | |
id: login | |
run: | | |
echo "${{ secrets.DOCKERHUB_TOKEN }}" |\ | |
docker login -u "${{ secrets.DOCKERHUB_USERNAME }}" --password-stdin | |
- name: Build and push | |
run: | | |
make DOCKER_TARGET=push LINUXKIT_TARGET=push DOCKER_PLATFORM=linux/arm64,linux/amd64 build-docker |