2021-08-24 11:44:17 +03:00
|
|
|
name: Create docker image(s) and push to docker hub
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
2021-12-09 00:02:43 +03:00
|
|
|
# Sequence of patterns matched against refs/heads
|
|
|
|
# prettier-ignore
|
|
|
|
branches:
|
|
|
|
# Push events on master branch
|
|
|
|
- master
|
|
|
|
# Sequence of patterns matched against refs/tags
|
|
|
|
tags:
|
|
|
|
- '[0-9]+\.[0-9]+\.[0-9]+' # Push events to 0.X.X tag
|
2021-08-24 11:44:17 +03:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
docker:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2023-01-16 22:13:25 +03:00
|
|
|
uses: actions/checkout@v3
|
2021-08-24 11:44:17 +03:00
|
|
|
- name: Set up QEMU
|
2023-01-16 22:06:09 +03:00
|
|
|
uses: docker/setup-qemu-action@v2
|
2021-08-24 11:44:17 +03:00
|
|
|
- name: Set up Docker Buildx
|
2023-01-24 11:50:09 +03:00
|
|
|
uses: docker/setup-buildx-action@v2
|
2021-08-24 11:44:17 +03:00
|
|
|
- name: Login to DockerHub
|
2023-01-16 22:13:12 +03:00
|
|
|
uses: docker/login-action@v2
|
2021-08-24 11:44:17 +03:00
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
2021-12-09 00:02:43 +03:00
|
|
|
- name: Calculate docker image tag
|
|
|
|
id: set-tag
|
|
|
|
run: |
|
|
|
|
case "${GITHUB_REF}" in
|
|
|
|
refs/heads/master|refs/heads/main)
|
|
|
|
tag=latest
|
|
|
|
;;
|
|
|
|
refs/tags/*)
|
|
|
|
tag=${GITHUB_REF#refs/tags/}
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
tag=${GITHUB_SHA}
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
echo "::set-output name=tag::$tag"
|
|
|
|
- name: Build and Push Tag
|
2023-08-31 10:24:22 +03:00
|
|
|
uses: docker/build-push-action@v4
|
2021-08-24 11:44:17 +03:00
|
|
|
with:
|
|
|
|
context: .
|
|
|
|
push: true
|
2021-12-09 00:02:43 +03:00
|
|
|
tags: "awesometechnologies/synapse-admin:${{ steps.set-tag.outputs.tag }}"
|
|
|
|
platforms: linux/amd64,linux/arm64
|