Merge pull request #27 from sacconazzo/develop #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 Image CI | |
"on": | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build: | |
name: Build and Publish Image | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Read the version from package.json | |
id: get_version | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
const fs = require('fs'); | |
const packageJson = fs.readFileSync('./package.json', 'utf8'); | |
const version = JSON.parse(packageJson).version; | |
core.setOutput('version', version); | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: sacconazzo | |
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | |
# - name: Build and push | |
# uses: docker/build-push-action@v6 | |
# with: | |
# # platforms: linux/amd64,linux/arm64 | |
# push: true | |
# tags: sacconazzo/directus-monorepo-cicd-boilerplate:${{ steps.get_version.outputs.version }} | |
- name: Build and Push Docker images | |
run: | | |
docker buildx build . --file Dockerfile --platform linux/amd64,linux/arm64 \ | |
--tag sacconazzo/directus-monorepo-cicd-boilerplate:${{ steps.get_version.outputs.version }} \ | |
--tag sacconazzo/directus-monorepo-cicd-boilerplate:latest \ | |
--push |