@@ -3,13 +3,28 @@ name: Build and push multi-platform docker images
33on :
44 push :
55 tags :
6- - ' ^v[0-9]{2}\.[0-9]{2}(\.[0-9]{1,2})?$'
6+ - ' ^v[0-9]{2}\.[0-9]{2}(\.[0-9]{1,2})?([a-zA-Z0-9]*)? $'
77 workflow_dispatch :
88 inputs :
99 version :
1010 description : ' Release version'
1111 required : true
1212
13+ repository-name :
14+ description : ' Docker repository name'
15+ default : ' elementsproject'
16+ required : false
17+
18+ platforms-to-build :
19+ description : ' List of platforms to build'
20+ default : ' linux/amd64,linux/arm64,linux/arm/v7'
21+ required : false
22+
23+ push-latest :
24+ description : ' Push the latest tag also?'
25+ default : ' false'
26+ required : false
27+
1328jobs :
1429 build :
1530 runs-on : ubuntu-latest
3045 username : ${{ secrets.DOCKER_USERNAME }}
3146 password : ${{ secrets.DOCKER_PASSWORD }}
3247
33- - name : Set up version
34- id : set-version
48+ - name : Set up values
49+ id : set-values
3550 run : |
3651 if [ "${{ github.event.inputs.version }}" != "" ]; then
3752 VERSION=${{ github.event.inputs.version }}
@@ -42,13 +57,58 @@ jobs:
4257 exit 1
4358 fi
4459 echo "VERSION=$VERSION" >> $GITHUB_ENV
45-
60+
61+ if [ "${{ github.event.inputs.repository-name }}" != "" ]; then
62+ REPONAME=${{ github.event.inputs.repository-name }}
63+ else
64+ REPONAME="elementsproject"
65+ fi
66+ echo "REPONAME=$REPONAME" >> $GITHUB_ENV
67+
68+ if [ "${{ github.event.inputs.platforms-to-build }}" != "" ]; then
69+ PLATFORMS=${{ github.event.inputs.platforms-to-build }}
70+ else
71+ PLATFORMS="linux/amd64,linux/arm64,linux/arm/v7"
72+ fi
73+ echo "PLATFORMS=$PLATFORMS" >> $GITHUB_ENV
74+
75+ if [
76+ "${{ github.event.inputs.push-latest }}" == "true" ||
77+ ( "${{ github.ref_type }}" == "tag" && [[ ! "${{ env.VERSION }}" =~ rc ]] )
78+ ]; then
79+ PUSHLATEST="true"
80+ else
81+ PUSHLATEST="false"
82+ fi
83+ echo "PUSHLATEST=$PUSHLATEST" >> $GITHUB_ENV
84+
85+ - name : Set Tags
86+ id : set-tags
87+ run : |
88+ TAGS="${{ env.REPONAME }}/lightningd:${{ env.VERSION }}"
89+ if [ "${{ env.PUSHLATEST }}" == "true" ]; then
90+ TAGS="$TAGS,${{ env.REPONAME }}/lightningd:latest"
91+ fi
92+ echo "TAGS=$TAGS" >> $GITHUB_ENV
93+
94+ - name : Print GitHub Ref Values
95+ run : |
96+ echo "GITHUB REF TYPE: ${{ github.ref_type }}"
97+ echo "GITHUB REF NAME: ${{ github.ref_name }}"
98+ echo "EVENT INPUT VERSION: ${{ github.event.inputs.version }}"
99+ echo "EVENT INPUT REPO: ${{ github.event.inputs.repository-name }}"
100+ echo "EVENT INPUT PLATFORMS: ${{ github.event.inputs.platforms-to-build }}"
101+ echo "EVENT INPUT PUSH LATEST: ${{ github.event.inputs.push-latest }}"
102+ echo "VERSION ENV: ${{ env.VERSION }}"
103+ echo "REPO NAME: ${{ env.REPONAME }}"
104+ echo "PLATFORMS: ${{ env.PLATFORMS }}"
105+ echo "PUSH LATEST: ${{ env.PUSHLATEST }}"
106+ echo "TAGS: ${{ env.TAGS }}"
107+
46108 - name : Build and push Docker image
47109 uses : docker/build-push-action@v5
48110 with :
49111 context : .
50112 push : true
51- platforms : linux/amd64,linux/arm64,linux/arm/v7
52- tags : |
53- elementsproject/lightningd:$VERSION
54- elementsproject/lightningd:latest
113+ platforms : ${{ env.PLATFORMS }}
114+ tags : ${{ env.TAGS }}
0 commit comments