Create and publish a Docker image #26
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: Create and publish a Docker image | |
on: | |
workflow_dispatch: | |
# pull_request: | |
# push: | |
# branches: ['release'] | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
build-image: | |
runs-on: ubuntu-latest | |
if: "!contains(github.event.head_commit.message, '[ci skip]')" | |
permissions: | |
contents: read | |
packages: write | |
name: ${{ matrix.config.r }} | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
# - { r: 'devel' } | |
# - { r: 'next' } | |
- { r: '4.3.2' } | |
# - { r: '4.2.3' } | |
# - { r: '4.1.3' } | |
# - { r: '4.0.5' } | |
# - { r: '3.6.3' } | |
# - { r: '3.5.3' } | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v1 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.repository_owner }} # | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
#- name: Configures Docker Buildx to create a builder instance for running the image build | |
# uses: docker/setup-buildx-action@v3 | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
#cache-from: type=gha | |
#cache-to: type=gha,mode=max | |
# - name: Build the Docker image | |
# - uses: actions/checkout@v3 | |
# run: docker build . --file Dockerfile --tag my-image-name:$(date +%s) | |
# - name: Log in to the Container registry | |
# uses: docker/login-action@v2 | |
# with: | |
# registry: $ | |
# username: $ | |
# password: $ | |
# - name: Docker Metadata | |
# id: meta | |
# uses: docker/metadata-action@v4 | |
# with: | |
# images: $/$ | |
# - name: Build and push Docker image | |
# uses: docker/build-push-action@v3 | |
# with: | |
# context: . | |
# push: true | |
# tags: $ | |
# labels: $ |