2023-01-24 21:13:56 +00:00
|
|
|
name: Test docker image creation
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
# Sequence of patterns matched against refs/heads
|
|
|
|
# prettier-ignore
|
|
|
|
branches:
|
|
|
|
# Push events on branch fix_docker_cd
|
|
|
|
- fix_docker_cd
|
|
|
|
# Sequence of patterns matched against refs/tags
|
|
|
|
tags:
|
|
|
|
- '[0-9]+\.[0-9]+\.[0-9]+' # Push events to 0.X.X tag
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
docker:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2023-09-05 06:23:03 +00:00
|
|
|
uses: actions/checkout@v4
|
2023-01-24 21:13:56 +00:00
|
|
|
- name: Set up QEMU
|
2024-02-02 14:04:05 +00:00
|
|
|
uses: docker/setup-qemu-action@v3
|
2023-01-24 21:13:56 +00:00
|
|
|
- name: Set up Docker Buildx
|
2024-02-02 14:04:39 +00:00
|
|
|
uses: docker/setup-buildx-action@v3
|
2023-01-24 21:13:56 +00:00
|
|
|
- name: Login to DockerHub
|
2024-02-02 14:04:29 +00:00
|
|
|
uses: docker/login-action@v3
|
2023-01-24 21:13:56 +00:00
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
- 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
|
2024-02-02 14:03:52 +00:00
|
|
|
uses: docker/build-push-action@v5
|
2023-01-24 21:13:56 +00:00
|
|
|
with:
|
|
|
|
context: .
|
|
|
|
push: false
|
|
|
|
tags: "awesometechnologies/synapse-admin:${{ steps.set-tag.outputs.tag }}"
|
|
|
|
platforms: linux/amd64,linux/arm64
|