Skip to content

Commit 8e837a2

Browse files
committed
fix nightly GH action
1 parent ceda142 commit 8e837a2

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

.github/workflows/nightly.yml

+17-10
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ jobs:
3737

3838
- name: Update version if newer
3939
run: |
40+
# Replace version in Dockerfiles if newer version exists
4041
CURRENT_VERSION=$(git describe --abbrev=0 --tags)
42+
CURRENT_VERSION=${CURRENT_VERSION%-*}
4143
LATEST_VERSION=$(git -c 'versionsort.suffix=-' ls-remote --tags --sort='v:refname' https://github.com/wiremock/wiremock.git '*.*.*' | tail -1 | cut -d '/' -f3)
4244
if [ "$CURRENT_VERSION" != "$LATEST_VERSION" ]
4345
then
@@ -90,16 +92,12 @@ jobs:
9092
new_version: ${{ steps.new_version.outputs.NEW_VERSION }}
9193
steps:
9294

93-
- name: Checkout sources
94-
uses: actions/checkout@main
95-
with:
96-
fetch-depth: 0
97-
9895
- name: Release if newer version
9996
run: |
100-
CURRENT_VERSION=$(git describe --abbrev=0 --tags)
97+
CURRENT_VERSION=$(git -c 'versionsort.suffix=-' ls-remote --tags --sort='v:refname' https://github.com/wiremock/wiremock-docker.git '*.*.*' | tail -1 | cut -d '/' -f3)
98+
CURRENT_VERSION=${CURRENT_VERSION%-*}
10199
LATEST_VERSION=$(git -c 'versionsort.suffix=-' ls-remote --tags --sort='v:refname' https://github.com/wiremock/wiremock.git '*.*.*' | tail -1 | cut -d '/' -f3)
102-
if [ "${CURRENT_VERSION%-*}" != "$LATEST_VERSION" ]
100+
if [ "$CURRENT_VERSION" != "$LATEST_VERSION" ]
103101
then
104102
echo "::set-output name=NEW_VERSION::$LATEST_VERSION"
105103
fi
@@ -141,9 +139,11 @@ jobs:
141139

142140
- name: Update version
143141
run: |
142+
# Replace version in Dockerfiles
144143
CURRENT_VERSION=$(git describe --abbrev=0 --tags)
145-
LATEST_VERSION=${{ needs.check-new-version.outputs.new_version }}
146-
sed -i s/${CURRENT_VERSION}/${LATEST_VERSION}/g Dockerfile alpine/Dockerfile
144+
CURRENT_VERSION=${CURRENT_VERSION%-*}
145+
NEW_VERSION=${{ needs.check-new-version.outputs.new_version }}
146+
sed -i s/${CURRENT_VERSION}/${NEW_VERSION}/g Dockerfile alpine/Dockerfile
147147
148148
- name: Login to Docker Hub
149149
uses: docker/login-action@v1
@@ -166,12 +166,19 @@ jobs:
166166

167167
- name: Update version
168168
run: |
169+
# Replace version in readme.md
169170
LAST_VERSION=$(git describe --tag --abbrev=0)
170171
LAST_MINOR_VERSION=${LAST_VERSION%.*}
171172
NEW_VERSION=${{ needs.check-new-version.outputs.new_version }}
172173
NEW_MINOR_VERSION=${NEW_VERSION%.*}
173-
sed -i s/${LAST_VERSION}/${NEW_VERSION}/g readme.md Dockerfile alpine/Dockerfile
174+
sed -i s/${LAST_VERSION}/${NEW_VERSION}/g readme.md
174175
sed -i s/${LAST_MINOR_VERSION}/${NEW_MINOR_VERSION}/g readme.md
176+
177+
# Replace version in Dockerfiles
178+
LAST_VERSION=${LAST_VERSION%-*}
179+
sed -i s/${LAST_VERSION}/${NEW_VERSION}/g Dockerfile alpine/Dockerfile
180+
181+
# Push update
175182
git config --local user.name "rodolpheche"
176183
git config --local user.email "[email protected]"
177184
git add .

0 commit comments

Comments
 (0)