Merge pull request #45 from serlo/push-images-to-ghcr #39
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 | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
update-version: | |
runs-on: ubuntu-latest | |
outputs: | |
tag: ${{ steps.version.outputs.tag }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
- id: version | |
uses: salsify/action-detect-and-tag-new-version@v2 | |
with: | |
tag-template: '{VERSION}' | |
version-command: | | |
cat VERSION | |
push: | |
runs-on: ubuntu-latest | |
needs: update-version | |
if: ${{ needs.update-version.outputs.tag }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- uses: docker/build-push-action@v6 | |
with: | |
push: true | |
file: ./Dockerfile | |
tags: ghcr.io/${{ github.repository }}:latest,ghcr.io/${{ github.repository }}/serlo-mysql-database:${{ needs.update-version.outputs.tag }} | |
- name: Test for mysql in the serlo-mysql-database image | |
run: | |
docker run --entrypoint='' --rm ghcr.io/${{ github.repository }}:latest mysql --version |