Skip to content

Commit

Permalink
Updated workflow config
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcusWichelmann committed May 2, 2021
1 parent 70e7bac commit a546847
Showing 1 changed file with 52 additions and 12 deletions.
64 changes: 52 additions & 12 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,62 @@
name: Publish Docker image

on:
release:
types: [published]
push:
branches:
- '**'
tags:
- 'v*.*.*'
pull_request:
branches:
- 'master'

jobs:
push_to_registry:
name: Push Docker image to GitHub Packages
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- name: Check out the repo
- name: Checkout
uses: actions/checkout@v2
- name: Push to GitHub Packages
uses: docker/build-push-action@v1

- name: Docker meta
id: meta
uses: crazy-max/ghaction-docker-meta@v2
with:
username: ${{ github.actor }}
images: ghcr.io/MarcusWichelmann/solaredge-exporter
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

# - name: Login to DockerHub
# if: github.event_name != 'pull_request'
# uses: docker/login-action@v1
# with:
# username: ${{ secrets.DOCKERHUB_USERNAME }}
# password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Login to GHCR
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: docker.pkg.github.com
repository: MarcusWichelmann/SolarEdgeExporter/solaredge-exporter
tag_with_ref: true

- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

0 comments on commit a546847

Please sign in to comment.