Skip to content

Commit

Permalink
Protect latest from pre-releases (#336)
Browse files Browse the repository at this point in the history
Fixes #318
  • Loading branch information
Gnuxie authored Apr 12, 2024
1 parent 86d1605 commit 198b65e
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 1 deletion.
48 changes: 48 additions & 0 deletions .github/workflows/docker-hub-latest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Copied from https://github.com/matrix-org/matrix-bifrost/blob/develop/.github/workflows/docker-hub-release.yml
# This is duplicated with docker-hub-release.yml the only difference is the tag and hook

name: "Docker Hub - Latest"

on:
release:
types: [released]

env:
DOCKER_NAMESPACE: gnuxie
PLATFORMS: linux/amd64,linux/arm64

jobs:
docker-release:
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v4
- name: Get release tag
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Unshallow for git describe so we can create version.txt
run: git fetch --prune --unshallow --tags --all --force
- name: Prepare version file
run: git describe > version.txt

# Needed for multi platform builds
- name: Set up QEMU
uses: docker/[email protected]

- name: Set up Docker Buildx
uses: docker/[email protected]

- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build image
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
platforms: ${{ env.PLATFORMS }}
push: true
tags: |
${{ env.DOCKER_NAMESPACE }}/draupnir:latest
2 changes: 1 addition & 1 deletion .github/workflows/docker-hub-release.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Copied from https://github.com/matrix-org/matrix-bifrost/blob/develop/.github/workflows/docker-hub-release.yml
# This is duplicated with docker-hub-latest.yml the only difference is the tag and hook

name: "Docker Hub - Release"

Expand Down Expand Up @@ -45,4 +46,3 @@ jobs:
push: true
tags: |
${{ env.DOCKER_NAMESPACE }}/draupnir:${{ env.RELEASE_VERSION }}
${{ env.DOCKER_NAMESPACE }}/draupnir:latest

0 comments on commit 198b65e

Please sign in to comment.