-
Notifications
You must be signed in to change notification settings - Fork 906
87 lines (76 loc) · 2.5 KB
/
docker-release.yml
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
name: Build and push multi-platform docker images
on:
push:
tags:
- '^v[0-9]{2}\.[0-9]{2}(\.[0-9]{1,2})?([a-zA-Z0-9]*)?$'
workflow_dispatch:
inputs:
version:
description: 'Release version'
required: true
repository-name:
description: 'Docker repository name'
default: 'ElementsProject'
required: false
push-latest:
description: 'Whether to push the latest tag'
default: 'true'
required: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Set up values
id: set-values
run: |
if [ "${{ github.event.inputs.version }}" != "" ]; then
VERSION=${{ github.event.inputs.version }}
elif [ "${{ github.ref_type }}" == "tag" ]; then
VERSION=${{ github.ref_name }}
else
echo "No version provided and no tag found."
exit 1
fi
echo "VERSION=$VERSION" >> $GITHUB_ENV
if [ "${{ github.event.inputs.repository-name }}" != "" ]; then
REPONAME=${{ github.event.inputs.repository-name }}
else
REPONAME="ElementsProject"
fi
echo "REPONAME=$REPONAME" >> $GITHUB_ENV
if [ "${{ github.event.inputs.push-latest }}" != "" ]; then
PUSHLATEST=${{ github.event.inputs.push-latest }}
else
PUSHLATEST="true"
fi
echo "PUSHLATEST=$PUSHLATEST" >> $GITHUB_ENV
- name: Print GitHub Ref Values
run: |
echo "GITHUB_REF_TYPE: ${{ github.ref_type }}"
echo "GITHUB_REF_NAME: ${{ github.ref_name }}"
echo "VERSION ENV: ${{ env.VERSION }}"
echo "VERSION: $VERSION"
echo "REPONAME=$REPONAME" >> $GITHUB_ENV
echo "PUSHLATEST=$PUSHLATEST" >> $GITHUB_ENV
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
platforms: linux/amd64,linux/arm64,linux/arm/v7
tags: |
${{ env.REPONAME }}/lightningd:${{ env.VERSION }}
if [ "${{ env.PUSHLATEST }}" == "true" ]; then
${{ env.REPONAME }}/lightningd:latest
fi