add related projects to README #92
Workflow file for this run
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: | |
- master | |
tags: | |
- 'v[0-9]+.[0-9]+.[0-9]+' | |
pull_request: | |
env: | |
GHCR_IMAGE: ghcr.io/anoadragon453/matrix-reminder-bot | |
HUB_IMAGE: anoa/matrix-reminder-bot | |
jobs: | |
build-python-versions-matrix: | |
strategy: | |
matrix: | |
version: ['3.8', '3.9', '3.10', '3.11'] | |
arch: ['linux/amd64', 'linux/arm64'] | |
fail-fast: false | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
platforms: linux/amd64,linux/arm64 | |
- name: Docker build | |
uses: docker/build-push-action@v5 | |
id: dockerBuild | |
with: | |
push: false | |
context: . | |
file: ./docker/Dockerfile | |
platforms: ${{ matrix.arch }} | |
build-args: | | |
PYTHON_VERSION=${{ matrix.version }} | |
build-push: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
outputs: | |
docker-tag: ${{ steps.meta.outputs.version }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Generate Docker metadata | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
${{ env.GHCR_IMAGE }} | |
labels: | | |
org.opencontainers.image.title=Matrix Reminder Bot | |
org.opencontainers.image.description=A bot to remind you about stuff. Supports encrypted rooms. | |
tags: | | |
type=ref,event=tag,enable=true,priority=900 | |
type=raw,value=dev,enable={{is_default_branch}},priority=700 | |
type=ref,event=pr,enable=true,priority=600 | |
- name: Setup buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
platforms: linux/amd64,linux/arm64 | |
- name: Login to ghcr.io | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Docker build and push | |
uses: docker/build-push-action@v5 | |
id: dockerBuild | |
with: | |
push: true | |
context: . | |
file: ./docker/Dockerfile | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
platforms: linux/amd64,linux/arm64 | |
mirror-dockerhub: | |
runs-on: ubuntu-latest | |
permissions: | |
packages: read | |
needs: [ build-push ] | |
if: ${{ github.ref.type == 'tag' }} | |
steps: | |
- name: Generate Docker metadata | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
${{ env.HUB_IMAGE }} | |
tags: | | |
type=ref,event=tag,enable=true,priority=900 | |
type=raw,value=dev,enable={{is_default_branch}},priority=700 | |
type=ref,event=pr,enable=true,priority=600 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Docker pull-tag-push | |
run: | | |
docker pull ${{ env.GHCR_IMAGE }}:${{ needs.build-push.outputs.docker-tag }} | |
for new_tag in $tags # bourne shell syntax splits string by space | |
do | |
docker tag ${{ env.GHCR_IMAGE }}:${{ needs.build-push.outputs.docker-tag }} $new_tag | |
docker push $new_tag | |
done |