Skip to content

trigger new release #14

trigger new release

trigger new release #14

Workflow file for this run

name: Publish docker image to GitHub Container Registry
on:
workflow_dispatch:
push:
branches: ['main']
paths: ['version']
env:
REGISTRY: ghcr.io
IMAGE_NAME: "" # Deliberately left empty, will be assigned the lower-cased repo slug: automattic/matrix-bots-wporg.
IMAGE_VERSION: "" # Deliberately left empty, will be assigned the value in the ./version file.
jobs:
publish-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Lowercase IMAGE_NAME
run: |
echo "IMAGE_NAME=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV}
- name: Assign version to environment variable
run: echo 'IMAGE_VERSION='$(cat version) >> $GITHUB_ENV
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install maubot
run: python -m pip install --upgrade pip maubot\[encryption\]
- name: Build custom plugins
run: |
set -e
rm -rf build
mkdir -p build
for PLUGIN in ./plugins/*/; do
if [[ "$PLUGIN" == "./plugins/example/" ]]; then
continue
fi
mbc build --output ./build/ "$PLUGIN"
done
shell: bash
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and publish image
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_VERSION }},${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
labels: ${{ steps.meta.outputs.labels }}