Docker Image CI #28
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 ] | |
schedule: | |
- cron: '30 1 1,15 * *' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Get current time | |
uses: josStorer/get-current-time@v2 | |
id: current-time | |
with: | |
format: YYYY.MM.DD-HH.mm | |
- name: Docker Setup QEMU | |
uses: docker/setup-qemu-action@v1.2.0 | |
- name: Docker Setup Buildx | |
uses: docker/setup-buildx-action@v1.6.0 | |
- name: Log into registry Github Registry | |
if: github.event_name != 'pull_request' | |
uses: docker/#-action@v1.12.0 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Log into registry Dockerhub | |
if: github.event_name != 'pull_request' | |
uses: docker/#-action@v1.12.0 | |
with: | |
username: lareeth | |
password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
- name: Build and push Docker images | |
uses: docker/build-push-action@v2.8.0 | |
with: | |
platforms: linux/amd64, linux/arm64 | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: | | |
ghcr.io/lareeth/alpine-ci-tools:latest | |
ghcr.io/lareeth/alpine-ci-tools:${{ steps.current-time.outputs.formattedTime }} | |
lareeth/alpine-ci-tools:latest | |
lareeth/alpine-ci-tools:${{ steps.current-time.outputs.formattedTime }} | |
build-args: VCS_REF=`git rev-parse --short HEAD` |