Docker build #14
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: Docker build | |
on: "workflow_dispatch" | |
jobs: | |
release: | |
name: Docker build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
ref: main | |
- name: Get version | |
uses: actions/github-script@v6 | |
id: version | |
with: | |
result-encoding: string | |
script: | | |
try { | |
const fs = require('fs'); | |
const jsonString = fs.readFileSync('./server/package.json'); | |
const packageJson = JSON.parse(jsonString); | |
return packageJson.version; | |
} catch(err) { | |
core.error("Error while reading or parsing the JSON"); | |
core.setFailed(err); | |
} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to DockerHub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Publish to Docker Hub | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
platforms: linux/arm64 | |
push: true | |
tags: bonukai/mediatracker:${{ steps.version.outputs.result }},bonukai/mediatracker:unstable,bonukai/mediatracker:latest |