2020-08-23 10:10:54 +02:00
|
|
|
on:
|
2020-09-06 07:44:56 +02:00
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- feat/push-to-github-container-registry
|
2020-08-23 10:10:54 +02:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
|
|
|
|
build:
|
|
|
|
name: Build, push, and deploy
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
|
|
|
|
- name: Checkout master
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
2020-09-04 01:32:09 +02:00
|
|
|
- name: Build PostgreSQL container image
|
2020-09-06 07:44:56 +02:00
|
|
|
run: |
|
|
|
|
docker build --build-arg DATABASE_TYPE=postgresql \
|
|
|
|
--tag ghcr.io/$GITHUB_ACTOR/umami:postgresql-$(echo $GITHUB_SHA | head -c7) \
|
|
|
|
--tag ghcr.io/$GITHUB_ACTOR/umami:postgresql-latest \
|
|
|
|
.
|
2020-08-23 10:10:54 +02:00
|
|
|
|
|
|
|
- name: Build MySQL container image
|
2020-09-06 07:44:56 +02:00
|
|
|
run: |
|
|
|
|
docker build --build-arg DATABASE_TYPE=mysql \
|
|
|
|
--tag ghcr.io/$GITHUB_ACTOR/umami:mysql-$(echo $GITHUB_SHA | head -c7) \
|
|
|
|
--tag ghcr.io/$GITHUB_ACTOR/umami:mysql-latest \
|
|
|
|
.
|
2020-08-23 10:10:54 +02:00
|
|
|
|
|
|
|
- name: Docker login
|
|
|
|
env:
|
2020-09-06 07:44:56 +02:00
|
|
|
CR_PAT: ${{ secrets.CR_PAT }}
|
|
|
|
run: docker login -u $GITHUB_ACTOR -p $CR_PAT ghcr.io
|
2020-08-23 10:10:54 +02:00
|
|
|
|
|
|
|
- name: Push image to GitHub
|
|
|
|
run: |
|
2020-09-06 07:44:56 +02:00
|
|
|
# Push each image individually, avoiding pushing to umami:latest
|
|
|
|
# as MySQL or PostgreSQL are required
|
|
|
|
docker push ghcr.io/$GITHUB_ACTOR/umami:postgresql-$(echo $GITHUB_SHA | head -c7)
|
|
|
|
docker push ghcr.io/$GITHUB_ACTOR/umami:postgresql-latest
|
|
|
|
docker push ghcr.io/$GITHUB_ACTOR/umami:mysql-$(echo $GITHUB_SHA | head -c7)
|
|
|
|
docker push ghcr.io/$GITHUB_ACTOR/umami:mysql-latest
|