0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-11-30 19:41:46 +01:00
posthog/.github/workflows/docker-unstable-image.yml
2021-10-25 14:59:31 -07:00

53 lines
1.9 KiB
YAML

# Generates the `posthog/posthog:release-[version]-unstable` Docker image and pushes to Docker Hub
# when a branch that matches `release-[version]` is pushed. Image can be used for break the release sessions.
name: Docker unstable image for code freeze
on:
push:
branches:
- 'release-*.*'
jobs:
build-release-push:
name: Build & push Docker release image
if: github.repository == 'PostHog/posthog'
runs-on: ubuntu-20.04
steps:
- name: Checkout default branch
uses: actions/checkout@v2
- name: Get branch name
run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV
- name: Update git SHA
run: echo "GIT_SHA = '${GITHUB_SHA}'" > posthog/gitsha.py
- name: Set up QEMU
if: github.repository == 'PostHog/posthog'
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
if: github.repository == 'PostHog/posthog'
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
if: github.repository == 'PostHog/posthog'
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push release
id: docker-release
if: github.repository == 'PostHog/posthog'
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: posthog/posthog:${{ env.BRANCH_NAME }}-unstable
- name: Image digest
if: github.repository == 'PostHog/posthog'
run: |
echo "Pushed release: ${{ steps.docker-release.outputs.digest }}"