Skip to content

Build and Publish

Build and Publish #1

Workflow file for this run

name: Build and Publish
on:
workflow_dispatch:
push:
tags-ignore:
- '**'
branches:
- '**'
jobs:
build:
env:
DOCKER_DEPLOY: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/waterdog-2' }}
runs-on: ubuntu-latest
permissions:
packages: write
contents: write
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Build
uses: ./.github/actions/build
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
perform_deploy: ${{ env.DOCKER_DEPLOY }}
deploy_repository: "waterdog-snapshots"
deploy_username: ${{ secrets.DEPLOY_USERNAME }}
deploy_password: ${{ secrets.DEPLOY_PASSWORD }}
create_prerelease: ${{ github.ref == 'refs/heads/master' }}
prerelease_name: "latest"
- name: Docker Login
uses: docker/login-action@v1
if: ${{ env.DOCKER_DEPLOY == 'true' }}
with:
registry: "ghcr.io"
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v4
if: ${{ env.DOCKER_DEPLOY == 'true' }}
with:
images: "ghcr.io/${{ github.repository }}"
tags: |
type=ref,event=branch
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'master') }}
- name: Docker build and push
uses: docker/build-push-action@v4
if: ${{ env.DOCKER_DEPLOY == 'true' && github.event_name != 'pull_request' }}
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}