Skip to content

Commit 9435806

Browse files
committed
Add fallback install to the latest version
1 parent a09025a commit 9435806

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

.github/workflows/publish.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,22 @@ jobs:
2828
uses: actions/checkout@v4
2929
with:
3030
ref: 'main'
31+
fetch-depth: 0
32+
33+
- name: Setup Node
34+
uses: actions/setup-node@v4
35+
with:
36+
node-version: lts/*
3137

3238
- name: Install Dependencies
3339
run: |
3440
sudo apt-get install jq
3541
36-
- name: Get Serverless Version
42+
- name: Get Latest Serverless Version
3743
id: sls
3844
run: |
3945
required_version="${{ github.event.inputs.version }}"
40-
version="$(git ls-remote --tags --refs --sort="v:refname" https://github.com/serverless/serverless.git | awk '{print $2}' | sed 's/refs\/tags\/v//' | tail -n1)"
46+
version="$(npm view serverless version)"
4147
if [[ -n "$required_version" ]]; then
4248
echo "Required version: $required_version"
4349
echo "version=$required_version" >> "$GITHUB_OUTPUT"
@@ -46,13 +52,13 @@ jobs:
4652
echo "version=$version" >> "$GITHUB_OUTPUT"
4753
fi
4854
49-
- name: Get Last Published Version
55+
- name: Get Latest Published Docker Version
5056
id: docker
5157
run: |
5258
image_repository="$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]' | sed 's/docker-//')"
5359
echo "$image_repository"
5460
echo "image_repository=$image_repository" >> "$GITHUB_OUTPUT"
55-
latest_published_tag="$(curl -L -s "https://hub.docker.com/v2/repositories/$image_repository/tags/?page_size=1024&page=1&ordering=last_updated" | jq '.results | .[1] | .name' | sed 's/"//g')"
61+
latest_published_tag="$(curl -L -s "https://hub.docker.com/v2/repositories/$image_repository/tags/?page_size=2&page=1&ordering=last_updated" | jq '.results | .[1] | .name' | sed 's/"//g')"
5662
echo "$latest_published_tag"
5763
echo "latest_published_tag=$latest_published_tag" >> "$GITHUB_OUTPUT"
5864

0 commit comments

Comments
 (0)