chore(actions): bump docker/build-push-action from 4 to 5 #31
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: Build Docker | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
if: github.actor != 'dependabot[bot]' | |
steps: | |
- uses: actions/checkout@v3 | |
# this is a simple way of using date and time to do versioning. | |
- name: Modify scripts and get version | |
id: version | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
const date = new Date(); | |
const year = date.getUTCFullYear(); | |
const month = `${date.getUTCMonth()+1}`.padStart(2, '0'); | |
const day = `${date.getUTCDate()}`.padStart(2, '0'); | |
const hour = `${date.getUTCHours()}`.padStart(2, '0'); | |
const minute = `${date.getUTCMinutes()}`.padStart(2, '0'); | |
const seconds = `${date.getUTCSeconds()}`.padStart(2, '0'); | |
core.setOutput('date_version', `${year}${month}${day}${hour}${minute}${seconds}`); | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
if: ${{ github.repository_owner == 'ShinyColorsWiki' && github.ref == 'refs/heads/master' }} | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Login to Quay.io Container Registry | |
uses: docker/login-action@v2 | |
if: ${{ github.repository_owner == 'ShinyColorsWiki' && github.ref == 'refs/heads/master' }} | |
with: | |
registry: quay.io | |
username: ${{ secrets.QUAY_USERNAME }} | |
password: ${{ secrets.QUAY_PASSWORD }} | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: ./ | |
file: ./Dockerfile | |
platforms: linux/amd64, linux/arm64 | |
push: ${{ github.repository_owner == 'ShinyColorsWiki' && github.ref == 'refs/heads/master' }} | |
tags: | | |
ghcr.io/shinycolorswiki/mediawiki-extension-downloader:latest | |
ghcr.io/shinycolorswiki/mediawiki-extension-downloader:${{ github.sha }} | |
ghcr.io/shinycolorswiki/mediawiki-extension-downloader:${{ steps.version.outputs.date_version }} | |
quay.io/shinycolorswiki/mediawiki-extension-downloader:latest | |
quay.io/shinycolorswiki/mediawiki-extension-downloader:${{ github.sha }} | |
quay.io/shinycolorswiki/mediawiki-extension-downloader:${{ steps.version.outputs.date_version }} | |
cache-from: type=gha,scope=${{ github.workflow }} | |
cache-to: type=gha,mode=max,scope=${{ github.workflow }} |