mirror of
https://github.com/nowcommunity/nowdatabase.git
synced 2026-10-12 19:13:52 +03:00
46 lines
1.3 KiB
YAML
46 lines
1.3 KiB
YAML
name: Build and deploy phpmyadmin
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- "phpmyadmin/**"
|
|
|
|
env:
|
|
IMAGE_NAME: phpmyadmin-nowdb
|
|
|
|
jobs:
|
|
push_phpmyadmin:
|
|
if: github.event_name == 'push'
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
packages: write
|
|
contents: read
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
|
|
- name: Build image
|
|
run: docker build -t phpmyadmin-nowdb phpmyadmin -f phpmyadmin/Dockerfile --tag $IMAGE_NAME
|
|
|
|
- name: Log in to registry
|
|
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
|
|
|
|
- name: Push image
|
|
run: |
|
|
IMAGE_ID=ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME
|
|
|
|
# This changes all uppercase characters to lowercase.
|
|
IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]')
|
|
|
|
# This strips the git ref prefix from the version.
|
|
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
|
|
|
|
# This strips the "v" prefix from the tag name.
|
|
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
|
|
|
|
VERSION=latest
|
|
echo IMAGE_ID=$IMAGE_ID
|
|
echo VERSION=$VERSION
|
|
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
|
|
docker push $IMAGE_ID:$VERSION
|