1
0
Fork 0
mirror of https://github.com/dragonflydb/dragonfly.git synced 2024-12-14 11:58:02 +00:00
dragonflydb-dragonfly/.github/workflows/docker-release.yml

104 lines
3 KiB
YAML
Raw Normal View History

2022-02-25 16:45:12 +00:00
name: docker release
on:
workflow_dispatch:
inputs:
TAG_NAME:
description: 'Tag name that the major tag will point to'
required: true
2022-06-06 15:32:11 +00:00
PRERELEASE:
description: 'Whether this is a prerelease'
type: boolean
required: false
release:
types: [published]
2022-02-25 16:45:12 +00:00
2022-05-11 17:37:25 +00:00
permissions:
packages: write
contents: read
env:
TAG_NAME: ${{ github.event.inputs.TAG_NAME || github.event.release.tag_name }}
IS_PRERELEASE: ${{ github.event.release.prerelease == true || github.event.inputs.PRERELEASE }}
2022-02-25 16:45:12 +00:00
jobs:
# ===============================================================
# Building Dev Images
# ===============================================================
release:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3
- uses: dsaltares/fetch-gh-release-asset@master
2022-02-25 16:45:12 +00:00
with:
2022-05-30 12:51:48 +00:00
version: 'tags/${{ env.TAG_NAME }}'
regex: true
file: "dragonfly-.*\\.tar\\.gz"
target: 'releases/'
token: ${{ secrets.GITHUB_TOKEN }}
2022-02-25 16:45:12 +00:00
- name: Set up QEMU
id: qemu
uses: docker/setup-qemu-action@v1
with:
platforms: arm64,amd64
2022-02-25 16:45:12 +00:00
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to GitHub Container Registry
2022-05-11 17:37:25 +00:00
uses: docker/login-action@v2
2022-02-25 16:45:12 +00:00
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract artifacts
run: |
echo "Event prerelease ${{ github.event.release.prerelease }}"
echo "Input prerelease ${{ github.event.inputs.PRERELEASE }}"
echo "env.IS_PRERELEASE ${{ env.IS_PRERELEASE}} "
ls -l
ls -l releases
2022-05-30 12:51:48 +00:00
for f in releases/*.tar.gz; do tar xvfz $f -C releases; done
rm releases/*.tar.gz
- name: Build release image
if: env.IS_PRERELEASE == 'false'
uses: docker/build-push-action@v3
with:
context: .
platforms: linux/amd64,linux/arm64
2022-05-11 17:37:25 +00:00
# Define QEMU settings inside the builder
build-args: |
QEMU_CPU=max,pauth-impdef=on
2022-05-11 17:37:25 +00:00
push: ${{ github.event_name != 'pull_request' }}
tags: |
2022-05-11 17:37:25 +00:00
ghcr.io/${{ github.repository }}:ubuntu
ghcr.io/${{ github.repository }}:latest
ghcr.io/${{ github.repository }}:${{ env.TAG_NAME }}
ghcr.io/${{ github.repository }}:${{ env.TAG_NAME }}-ubuntu
2022-05-11 17:37:25 +00:00
file: tools/docker/Dockerfile.ubuntu-prod
cache-from: type=registry,ref=${{ github.repository }}:latest
cache-to: type=inline
- name: Build pre-release image
if: env.IS_PRERELEASE == 'true'
uses: docker/build-push-action@v3
with:
context: .
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: |
ghcr.io/${{ github.repository }}:alpha
ghcr.io/${{ github.repository }}:${{ env.TAG_NAME }}
file: tools/docker/Dockerfile.ubuntu-prod
cache-from: type=registry,ref=${{ github.repository }}:latest
cache-to: type=inline