Skip to content

Commit bb72ad3

Browse files
github: Actions trigger of tag push
Changelog-Fixed: Regex expression for github actions tags push trigger.
1 parent 84b3e80 commit bb72ad3

File tree

2 files changed

+47
-27
lines changed

2 files changed

+47
-27
lines changed

.github/workflows/docker-release.yml

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ name: Build and push multi-platform docker images
33
on:
44
push:
55
tags:
6-
- '^v[0-9]{2}\.[0-9]{2}(\.[0-9]{1,2})?([a-zA-Z0-9]*)?$'
6+
- 'v[0-9]+.[0-9]+'
7+
- 'v[0-9]+.[0-9]+.[0-9]+'
8+
- 'v[0-9]+.[0-9]+[0-9a-z]+'
79
workflow_dispatch:
810
inputs:
911
version:
@@ -48,46 +50,45 @@ jobs:
4850
- name: Set up values
4951
id: set-values
5052
run: |
51-
if [ "${{ github.event.inputs.version }}" != "" ]; then
53+
if [[ "${{ github.event.inputs.version }}" != "" ]]; then
54+
echo "Input version provided"
5255
VERSION=${{ github.event.inputs.version }}
53-
elif [ "${{ github.ref_type }}" == "tag" ]; then
56+
elif [[ ${{ github.ref_type }} == "tag" ]]; then
57+
echo "This is a tag event"
5458
VERSION=${{ github.ref_name }}
5559
else
5660
echo "No version provided and no tag found."
5761
exit 1
5862
fi
5963
echo "VERSION=$VERSION" >> $GITHUB_ENV
6064
61-
if [ "${{ github.event.inputs.repository-name }}" != "" ]; then
65+
if [[ "${{ github.event.inputs.repository-name }}" != "" ]]; then
6266
REPONAME=${{ github.event.inputs.repository-name }}
6367
else
6468
REPONAME="elementsproject"
6569
fi
6670
echo "REPONAME=$REPONAME" >> $GITHUB_ENV
6771
68-
if [ "${{ github.event.inputs.platforms-to-build }}" != "" ]; then
72+
if [[ "${{ github.event.inputs.platforms-to-build }}" != "" ]]; then
6973
PLATFORMS=${{ github.event.inputs.platforms-to-build }}
7074
else
7175
PLATFORMS="linux/amd64,linux/arm64,linux/arm/v7"
7276
fi
7377
echo "PLATFORMS=$PLATFORMS" >> $GITHUB_ENV
7478
75-
if [
76-
"${{ github.event.inputs.push-latest }}" == "true" ||
77-
( "${{ github.ref_type }}" == "tag" && [[ ! "${{ env.VERSION }}" =~ rc ]] )
78-
]; then
79+
if [[ "${{ github.event.inputs.push-latest }}" == "true" ]] ||
80+
([[ "${{ github.ref_type }}" == "tag" ]] && [[ ! "$VERSION" =~ rc ]]); then
81+
echo "Latest true"
7982
PUSHLATEST="true"
8083
else
84+
echo "Latest false"
8185
PUSHLATEST="false"
8286
fi
8387
echo "PUSHLATEST=$PUSHLATEST" >> $GITHUB_ENV
8488
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"
89+
TAGS="$REPONAME/lightningd:$VERSION"
90+
if [[ "$PUSHLATEST" == "true" ]]; then
91+
TAGS="$TAGS,$REPONAME/lightningd:latest"
9192
fi
9293
echo "TAGS=$TAGS" >> $GITHUB_ENV
9394
@@ -99,11 +100,11 @@ jobs:
99100
echo "EVENT INPUT REPO: ${{ github.event.inputs.repository-name }}"
100101
echo "EVENT INPUT PLATFORMS: ${{ github.event.inputs.platforms-to-build }}"
101102
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 }}"
103+
echo "ENV VERSION: ${{ env.VERSION }}"
104+
echo "ENV REPO NAME: ${{ env.REPONAME }}"
105+
echo "ENV PLATFORMS: ${{ env.PLATFORMS }}"
106+
echo "ENV PUSH LATEST: ${{ env.PUSHLATEST }}"
107+
echo "ENV TAGS: ${{ env.TAGS }}"
107108
108109
- name: Build and push Docker image
109110
uses: docker/build-push-action@v5

.github/workflows/pypi.yml

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,15 @@ name: Publish Python 🐍 distributions 📦 to PyPI and TestPyPI
33
on:
44
push:
55
tags:
6-
'^v[0-9]{2}\.[0-9]{2}(\.[0-9]{1,2})?$'
6+
- 'v[0-9]+.[0-9]+'
7+
- 'v[0-9]+.[0-9]+.[0-9]+'
8+
- 'v[0-9]+.[0-9]+[0-9a-z]+'
79
workflow_dispatch:
10+
inputs:
11+
dist-location:
12+
description: 'Distribution location (test/prod)'
13+
default: 'test'
14+
required: false
815

916
jobs:
1017
deploy:
@@ -21,8 +28,6 @@ jobs:
2128
WORKDIR: contrib/pyln-testing
2229
- PACKAGE: pyln-proto
2330
WORKDIR: contrib/pyln-proto
24-
- PACKAGE: pyln-grpc-proto
25-
WORKDIR: contrib/pyln-grpc-proto
2631
steps:
2732
- name: Checkout repository
2833
uses: actions/checkout@v4
@@ -40,6 +45,20 @@ jobs:
4045
run: |
4146
echo "VERSION=$(git describe --abbrev=0).post$(git describe --abbrev=1 | awk -F "-" '{print $2}')" >> $GITHUB_ENV
4247
48+
- name: Set up values
49+
id: set-values
50+
run: |
51+
if [[ "${{ github.event.inputs.dist-location }}" != "" ]]; then
52+
DISTLOCATION=${{ github.event.inputs.dist-location }}
53+
elif [[ "${{ github.ref_type }}" == "tag" ]] && [[ ! "${{ github.ref_name }}" =~ rc ]]; then
54+
DISTLOCATION="prod"
55+
else
56+
DISTLOCATION="test"
57+
fi
58+
echo "DISTLOCATION=$DISTLOCATION" >> $GITHUB_OUTPUT
59+
echo "EVENT DISTLOCATION: ${{ github.event.inputs.dist-location }}"
60+
echo "DISTRIBUTION LOCATION: $DISTLOCATION"
61+
4362
- name: Install Poetry
4463
env:
4564
WORKDIR: ${{ matrix.WORKDIR }}
@@ -49,13 +68,13 @@ jobs:
4968
echo "PATH=$HOME/.local/bin:$PATH"
5069
5170
- name: Publish distribution 📦 to Test PyPI
52-
if: github.event_name == 'workflow_dispatch' && github.repository == 'ElementsProject/lightning'
71+
if: github.repository == 'ElementsProject/lightning' && steps.set-values.outputs.DISTLOCATION == 'test'
5372
env:
5473
POETRY_PYPI_TOKEN_TESTPYPI: ${{ secrets.TEST_PYPI_API_TOKEN }}
5574
WORKDIR: ${{ matrix.WORKDIR }}
5675
run: |
5776
echo "POETRY VERSION TEST: $(poetry --version)"
58-
echo "Pyln* VERSION: $VERSION"
77+
echo "Pyln VERSION: $VERSION"
5978
cd ${{ env.WORKDIR }}
6079
python3 -m pip config set global.timeout 150
6180
poetry config repositories.testpypi https://test.pypi.org/legacy/
@@ -64,15 +83,15 @@ jobs:
6483
poetry publish --repository testpypi --no-interaction --skip-existing
6584
6685
- name: Publish distribution 📦 to PyPI
67-
if: startsWith(github.ref, 'refs/tags/v') && github.repository == 'ElementsProject/lightning'
86+
if: github.repository == 'ElementsProject/lightning' && steps.set-values.outputs.DISTLOCATION == 'prod'
6887
env:
6988
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }}
7089
WORKDIR: ${{ matrix.WORKDIR }}
7190
run: |
7291
echo "POETRY VERSION PUBLISH: $(poetry --version)"
73-
echo "Pyln* VERSION: $VERSION"
7492
cd ${{ env.WORKDIR }}
7593
export VERSION=$(git describe --abbrev=0)
94+
echo "Pyln VERSION: $VERSION"
7695
make upgrade-version NEW_VERSION=$VERSION
7796
python3 -m pip config set global.timeout 150
7897
poetry build --no-interaction

0 commit comments

Comments
 (0)