File tree Expand file tree Collapse file tree 4 files changed +117
-8
lines changed Expand file tree Collapse file tree 4 files changed +117
-8
lines changed Original file line number Diff line number Diff line change 1616 run : |
1717 set -e
1818 pwd
19- ANCESTOR_TAG=$(git describe --tags --abbrev=0 2>/dev/null)
19+ ANCESTOR_TAG=$(git describe --tags --exclude=${{ inputs.current-tag }} -- abbrev=0 2>/dev/null)
2020 echo "ANCESTOR_TAG=$ANCESTOR_TAG"
2121 echo "ANCESTOR_TAG=$ANCESTOR_TAG" >> $GITHUB_ENV
2222
@@ -26,10 +26,15 @@ runs:
2626 run : |
2727 REPO="${{ github.repository }}"
2828 LATEST_TAG=$(curl -s "https://api.github.com/repos/$REPO/releases/latest" | jq -r '.tag_name')
29- if [ "$LATEST_TAG" = "null" ]; then
30- LATEST_TAG=$(curl -s "https://api.github.com/repos/$REPO/tags" | jq -r '.[0].name')
29+ if [ "$LATEST_TAG" = "null" ] || [ "$LATEST_TAG" = "${{ inputs.current-tag }}" ]; then
30+ LATEST_TAG=$(curl -s "https://api.github.com/repos/$REPO/releases?per_page=20" \
31+ | jq -r --arg CURRENT "${{ inputs.current-tag }}" \
32+ '.[] | select(
33+ .draft == false and
34+ .tag_name != $CURRENT
35+ ) | .tag_name' \
36+ | head -n 1)
3137 fi
32- echo "LATEST_TAG=$LATEST_TAG"
3338 echo "LATEST_TAG=$LATEST_TAG" >> $GITHUB_ENV
3439
3540 - id : get-tag
Original file line number Diff line number Diff line change 44 push :
55 tags :
66 - ' *'
7+ workflow_dispatch :
8+ inputs :
9+ tag :
10+ description : ' release tag'
11+ required : false
12+ type : string
13+ publish_release :
14+ description : ' whether to publish to github release'
15+ required : false
16+ type : boolean
17+ default : true
718
819permissions :
920 contents : write
1021
1122jobs :
12- android-release :
23+ get-version :
1324 runs-on : lynx-ubuntu-22.04-medium
25+ timeout-minutes : 60
26+ outputs :
27+ version : ${{ steps.get_version.outputs.VERSION }}
28+ steps :
29+ - name : Get Version
30+ id : get_version
31+ run : |-
32+ if [ ${{ github.event_name }} == 'workflow_dispatch' ]; then
33+ version=${{ github.event.inputs.tag }}
34+ else
35+ version=$(echo ${{ github.ref }} | awk -F "/" '{print $3}')
36+ fi
37+ if [[ $version =~ ^[0-9]+\.[0-9]+\.[0-9]+$ || \
38+ $version =~ ^[0-9]+\.[0-9]+\.[0-9]+-rc\.[0-9]+$ || \
39+ $version =~ ^[0-9]+\.[0-9]+\.[0-9]+-alpha\.[0-9]+$ ]]; then
40+ echo "Version is valid"
41+ echo "VERSION=$version" >> $GITHUB_OUTPUT;
42+ else
43+ echo "Version is invalid"
44+ exit 1
45+ fi
1446
47+ android-release :
48+ runs-on : lynx-ubuntu-22.04-medium
49+ needs : get-version
1550 steps :
1651 - name : Download Source
17522358
2459 - name : Get Tag Information
2560 run : |-
26- version=$(echo $ {{ github.ref }} | awk -F "/" '{print $3}')
61+ version=${{ needs.get-version.outputs.version }}
2762 echo "VERSION=$version" >> $GITHUB_OUTPUT;
2863 id : get_tag
2964
5691 id : build_artifact
5792
5893 - name : Push to release
94+ if : ${{ github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.publish_release == true) }}
5995 uses : ncipollo/release-action@v1
6096 with :
6197 tag : ${{ steps.get_tag.outputs.VERSION }}
Original file line number Diff line number Diff line change 44 push :
55 tags :
66 - ' *'
7+ workflow_dispatch :
8+ inputs :
9+ tag :
10+ description : ' release tag'
11+ required : false
12+ type : string
13+ publish_release :
14+ description : ' whether to publish to github release'
15+ required : false
16+ type : boolean
17+ default : true
718
819jobs :
20+ get-version :
21+ runs-on : lynx-ubuntu-22.04-medium
22+ timeout-minutes : 60
23+ outputs :
24+ version : ${{ steps.get_version.outputs.VERSION }}
25+ steps :
26+ - name : Get Version
27+ id : get_version
28+ run : |-
29+ if [ ${{ github.event_name }} == 'workflow_dispatch' ]; then
30+ version=${{ github.event.inputs.tag }}
31+ else
32+ version=$(echo ${{ github.ref }} | awk -F "/" '{print $3}')
33+ fi
34+ if [[ $version =~ ^[0-9]+\.[0-9]+\.[0-9]+$ || \
35+ $version =~ ^[0-9]+\.[0-9]+\.[0-9]+-rc\.[0-9]+$ || \
36+ $version =~ ^[0-9]+\.[0-9]+\.[0-9]+-alpha\.[0-9]+$ ]]; then
37+ echo "Version is valid"
38+ echo "VERSION=$version" >> $GITHUB_OUTPUT;
39+ else
40+ echo "Version is invalid"
41+ exit 1
42+ fi
43+
944 harmony-release :
1045 runs-on : lynx-container
46+ needs : get-version
1147 container :
1248 image : ghcr.io/lynx-family/ubuntu24.04-harmony@sha256:8eb0ee8da7e8592669f0fcd41d0e1bc818b33a75e27943521f57af87d04db2fb
1349 credentials :
3470 uses : ./.github/actions/get-latest-tag
3571 - name : Get Tag Information
3672 run : |-
37- version=$(echo $ {{ github.ref }} | awk -F "/" '{print $3}')
73+ version=${{ needs.get-version.outputs.version }}
3874 echo "VERSION=$version" >> $GITHUB_OUTPUT;
3975 id : get_tag
4076 - name : Install deps
66102 popd
67103 popd
68104 - name : Push to release
105+ if : ${{ github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && inputs.publish_release == true) }}
69106 uses : ncipollo/release-action@v1
70107 with :
71108 tag : ${{ steps.get_tag.outputs.VERSION }}
Original file line number Diff line number Diff line change 44 push :
55 tags :
66 - ' *'
7+ workflow_dispatch :
8+ inputs :
9+ tag :
10+ description : ' release tag'
11+ required : false
12+ type : string
713
814jobs :
15+ get-version :
16+ runs-on : lynx-ubuntu-22.04-medium
17+ timeout-minutes : 60
18+ outputs :
19+ version : ${{ steps.get_version.outputs.VERSION }}
20+ steps :
21+ - name : Get Version
22+ id : get_version
23+ run : |-
24+ if [ ${{ github.event_name }} == 'workflow_dispatch' ]; then
25+ version=${{ github.event.inputs.tag }}
26+ else
27+ version=$(echo ${{ github.ref }} | awk -F "/" '{print $3}')
28+ fi
29+ if [[ $version =~ ^[0-9]+\.[0-9]+\.[0-9]+$ || \
30+ $version =~ ^[0-9]+\.[0-9]+\.[0-9]+-rc\.[0-9]+$ || \
31+ $version =~ ^[0-9]+\.[0-9]+\.[0-9]+-alpha\.[0-9]+$ ]]; then
32+ echo "Version is valid"
33+ echo "VERSION=$version" >> $GITHUB_OUTPUT;
34+ else
35+ echo "Version is invalid"
36+ exit 1
37+ fi
38+
939 publish-pod :
1040 runs-on : macos-13
41+ needs : get-version
1142 steps :
1243 - name : Download Source
13441647 SDKROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk bundle install --path .bundle
1748 - name : Get Tag Information
1849 run : |-
19- version=$(echo $ {{ github.ref }} | awk -F "/" '{print $3}')
50+ version=${{ needs.get-version.outputs.version }}
2051 echo "VERSION=$version" >> $GITHUB_OUTPUT;
2152 id : get_tag
2253 - name : Publish to CocoaPods Repo
You can’t perform that action at this time.
0 commit comments