Skip to content

Make release

Make release #6

Workflow file for this run

name: Make release
on:
workflow_dispatch:
inputs:
version:
description: "version to release, e.g. v1.5.13"
required: true
default: "v0.1.0"
source_ref:
description: "source ref to publish from. E.g.: main or release-x.y"
required: true
default: "main"
pre_release:
description: "Is release a pre-release ? "
required: true
default: false
type: boolean
jobs:
create-release-branch:
runs-on: ubuntu-latest
permissions:
contents: write # Allows pushing branches
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # Ensure full history
ref: ${{ github.event.inputs.source_ref }}
- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
- name: Create and push new branch
env:
VERSION: ${{ github.event.inputs.version }}
run: |
NEW_BRANCH="release-${VERSION}"
git checkout -b $NEW_BRANCH
git push origin $NEW_BRANCH
release:
name: Make release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.event.inputs.version }}
name: Release ${{ github.event.inputs.version }}
draft: false
prerelease: ${{ github.event.inputs.pre_release }}
token: ${{ secrets.GITHUB_TOKEN }}
generate_release_notes: true
append_body: true
build-and-publish-docker:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Ensure full history
- name: Docker meta
id: docker_meta
uses: docker/metadata-action@v5
with:
images: inseefrlab/s3-operator # list of Docker images to use as base name for tags
tags: |
type=raw,value=${{ github.event.inputs.version }}
type=raw,value=latest,enable=${{ !github.event.inputs.pre_release }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
id: build_push
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
tags: |
${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}
platforms: linux/amd64,linux/arm64
- name: Image digest
run: echo ${{ steps.build_push.outputs.digest }}