Create .changelog #60
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: '*' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Obtain repository and tag names | |
shell: bash | |
run: | | |
if [ -z "${{ secrets.DOCKER_HUB_REPO }}" ]; then | |
echo "repo=${{ secrets.DOCKER_HUB_USERNAME }}" >> $GITHUB_OUTPUT | |
else | |
echo "repo=${{ secrets.DOCKER_HUB_REPO }}" >> $GITHUB_OUTPUT | |
fi | |
echo "tag=$(echo ${GITHUB_REF#refs/heads/} | sed 's/^main$/latest/g')" >> $GITHUB_OUTPUT | |
id: extract_tag | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Build and push | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
file: ./Dockerfile | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: ${{ steps.extract_tag.outputs.repo }}/docker-desktop:${{ steps.extract_tag.outputs.tag }} | |
cache-from: type=registry,ref=${{ steps.extract_tag.outputs.repo }}/docker-desktop:buildcache | |
cache-to: type=registry,ref=${{ steps.extract_tag.outputs.repo }}/docker-desktop:buildcache,mode=max | |
# Reference: https://docs.docker.com/ci-cd/github-actions/ |