41 lines
970 B
YAML
41 lines
970 B
YAML
name: Publish Image
|
|
|
|
on:
|
|
push:
|
|
branches: ['master']
|
|
tags: ['*']
|
|
|
|
env:
|
|
DOCKER_HUB_USER: phlak
|
|
|
|
jobs:
|
|
build-and-push:
|
|
name: Build & Push
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout Repository
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Log in to Docker Hub
|
|
uses: docker/login-action@v1
|
|
with:
|
|
username: ${{ env.DOCKER_HUB_USER }}
|
|
password: ${{ secrets.DOCKER_HUB_TOKEN }}
|
|
|
|
- name: Extract Metadata
|
|
id: extract-metadata
|
|
uses: docker/metadata-action@v3
|
|
with:
|
|
images: ${{ env.DOCKER_HUB_USER }}/minecraft
|
|
tags: |
|
|
type=raw,value=latest
|
|
type=ref,event=tag
|
|
|
|
- name: Build & Push Image
|
|
uses: docker/build-push-action@v2
|
|
with:
|
|
push: ${{ github.event_name != 'pull_request' }}
|
|
tags: ${{ steps.extract-metadata.outputs.tags }}
|
|
labels: ${{ steps.extract-metadata.outputs.labels }}
|