-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathShared-Release-On-DockerHub.yml
More file actions
97 lines (85 loc) · 3.21 KB
/
Shared-Release-On-DockerHub.yml
File metadata and controls
97 lines (85 loc) · 3.21 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
# *************************************************************************
# ** Copyright (c) 2022-25 CentraleSupélec & EDF.
# ** All rights reserved. This program and the accompanying materials
# ** are made available under the terms of the Eclipse Public License v2.0
# ** which accompanies this distribution, and is available at
# ** https://www.eclipse.org/legal/epl-v20.html
# **
# ** This file is part of the RiseClipse tool
# **
# ** Contributors:
# ** Computer Science Department, CentraleSupélec
# ** EDF R&D
# ** Contacts:
# ** dominique.marcadet@centralesupelec.fr
# ** aurelie.dehouck-neveu@edf.fr
# ** Web site:
# ** https://riseclipse.github.io
# *************************************************************************
name: Release on DockerHub
# This CD workflow releases a Docker version of CLI tool
# Secrets are not passed when calling reusable workflows, so you must pass them from caller
on:
workflow_call:
inputs:
release_version:
type: string
required: true
description: the tag that will be used for the docker image
docker_repository:
type: string
required: true
description: the name of the docker repository where the image will be put
release_latest:
type: boolean
required: false
default: true
description: whether the image should also be tagged with latest
secrets:
DOCKER_USER:
required: true
DOCKER_PASSWORD:
required: true
jobs:
publish_dockerhub:
# Use a specific version to avoid unattended changes with latest
runs-on: ubuntu-24.04
steps:
- name: Setup Environment
run: sudo apt-get install rename
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v4
# NB: Needs to contain a Dockerfile at root of repository
- name: Checkout ${{ github.event.repository.name }}
uses: actions/checkout@v6
with:
path: ${{ github.event.repository.name }}
- name: Download artifacts
uses: dawidd6/action-download-artifact@v18
with:
github_token: ${{secrets.GITHUB_TOKEN}}
workflow: Pre-Release-and-Prepare-Next-Dev.yml
workflow_conclusion: success
path: ${{ github.workspace }}/${{ github.event.repository.name }}/artifacts
- name: Rename folder to avoid errors
run: |
cd ${{ github.workspace }}/${{ github.event.repository.name }}/artifacts
rename 's/.jar//' *.jar
- name: Log in to Docker Hub
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push Docker image with given tag
uses: docker/build-push-action@v7
with:
context: ${{ github.workspace }}/${{ github.event.repository.name }}
push: true
tags: riseclipse/${{ inputs.DOCKER_REPOSITORY }}:${{ inputs.release_version }}
- name: Build and push Docker image with latest tag
if: inputs.release_latest
uses: docker/build-push-action@v7
with:
context: ${{ github.workspace }}/${{ github.event.repository.name }}
push: true
tags: riseclipse/${{ inputs.DOCKER_REPOSITORY }}:latest