-
Notifications
You must be signed in to change notification settings - Fork 17
107 lines (93 loc) · 3 KB
/
Copy pathrelease.yml
File metadata and controls
107 lines (93 loc) · 3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
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
push: true
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 }}