PUBLISH #32
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" | |
on: | |
workflow_dispatch: | |
workflow_call: | |
inputs: | |
environment: | |
required: true | |
type: string | |
secrets: | |
DOCKER_USERNAME: | |
required: true | |
DOCKER_PASSWORD: | |
required: true | |
workflow_run: | |
workflows: ["CICD"] | |
types: | |
- completed | |
branches: | |
- 'main' | |
jobs: | |
publish: | |
runs-on: self-hosted | |
environment: prod | |
steps: | |
- name: "Checkout code" | |
uses: actions/checkout@v3 | |
- name: "Delete old images" | |
run: docker rmi -f homekit-monitord nginx; exit 0 | |
- name: "Login to docker hub" | |
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin | |
- name: "Install buildx" | |
id: buildx | |
uses: crazy-max/ghaction-docker-buildx@v1 | |
with: | |
buildx-version: latest | |
- name: "Build and push the image" | |
run: | | |
docker buildx build --push \ | |
--tag clickbg/homekit-monitord:latest \ | |
--platform linux/arm/v5,linux/arm/v7,linux/arm64/v8,linux/amd64 . |