added latest #8
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
# derived from https://docs.github.com/en/packages/managing-github-packages-using-github-actions-workflows/publishing-and-installing-a-package-with-github-actions | |
name: Create and publish Docker image | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
- v* | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository_owner }}/tibber-pulse-reader | |
jobs: | |
build-and-push-image: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Log in to the Container registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
- name: Build with Maven | |
run: mvn --batch-mode --update-snapshots package | |
# - name: Upload jar to mega.nz | |
# uses: Difegue/action-megacmd@043c6d2a167af3ae0904fc88c6b2829e4140dc8d | |
# with: | |
# args: put target/tibber-pulse-reader-1.0.0-SNAPSHOT.jar /tibber-pulse-reader/tibber-pulse-reader.${{ github.ref_name }}.jar | |
# env: | |
# USERNAME: ${{ secrets.MEGA_USERNAME }} | |
# PASSWORD: ${{ secrets.MEGA_PASSWORD }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v4 | |
with: | |
platforms: linux/amd64,linux/arm64 | |
context: . | |
file: ./Dockerfile | |
push: true | |
tags: ${{ steps.meta.outputs.tags }}, ${{ github.event.repository.name }}:latest | |
labels: ${{ steps.meta.outputs.labels }} | |
- name: Build and push Docker image for Alpine | |
uses: docker/build-push-action@v4 | |
with: | |
platforms: linux/amd64 | |
context: . | |
file: ./Dockerfile-Alpine | |
push: true | |
tags: ${{ steps.meta.outputs.tags }}-alpine | |
labels: ${{ steps.meta.outputs.labels }} |