@@ -5,7 +5,8 @@ name: Build and Publish
55# 2. android - Builds the Android app and uploads it to Google Play (if requested)
66# 3. docker - Builds the Docker image and pushes it to GitHub Container Registry
77# 4. ios - Builds the iOS app and uploads it to App Store (if requested)
8- # 5. github-release - Tags the commit and creates a Github release with the apps' binaries (if requested)
8+ # 5. tag - Tags the built commit with the version string
9+ # 6. github-release - Creates a Github release with the apps' binaries (if requested)
910
1011on :
1112 workflow_dispatch :
5253 PATCH : ${{ github.run_number }}
5354 run : |
5455 version_string=$MAJOR.$MINOR.$(($PATCH % 1000))
55- echo "version_code=$(($MAJOR * 100000 + $MINOR * 1000 + $PATCH % 1000))" >> $GITHUB_OUTPUT
56+ version_code=$(($MAJOR * 100000 + $MINOR * 1000 + $PATCH % 1000))
57+ echo "version_code=$version_code" >> $GITHUB_OUTPUT
5658 echo "version_string=$version_string" >> $GITHUB_OUTPUT
57- echo "Version: $version_string" >> $GITHUB_STEP_SUMMARY
59+ commit_url="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/commit/$GITHUB_SHA"
60+ {
61+ echo "### Build and Publish $version_string"
62+ echo ""
63+ echo "| | |"
64+ echo "| --- | --- |"
65+ echo "| Version | \`$version_string\` |"
66+ echo "| Version code | \`$version_code\` |"
67+ echo "| Commit | [\`$(git rev-parse --short HEAD)\`]($commit_url) - $(git log -1 --pretty=%s) |"
68+ echo "| Ref | \`$GITHUB_REF_NAME\` |"
69+ echo "| Docker image | \`ghcr.io/israelhikingmap/website-mapeak:$version_string\` |"
70+ } >> $GITHUB_STEP_SUMMARY
5871 - name : Get all milestones
5972 id : get_milestones
6073 uses : octokit/request-action@v3.0.0
@@ -233,17 +246,32 @@ jobs:
233246 env :
234247 APPSTORE_CONNECT_API_KEY : ${{ secrets.APPSTORE_CONNECT_API_KEY }}
235248
236- github-release :
237- if : ${{ github.event.inputs.production == 'true ' }}
249+ tag :
250+ if : ${{ github.ref == 'refs/heads/main ' }}
238251 runs-on : ubuntu-latest
239252 needs : [version, ios, android]
253+ permissions :
254+ contents : write
240255 steps :
241256 - name : Checkout code
242257 uses : actions/checkout@v7.0.1
243258 - name : Tag commit and push
259+ env :
260+ VERSION : ${{ needs.version.outputs.version_string }}
244261 run : |
245- git tag "v${{ needs.version.outputs.version_string }}"
246- git push origin "v${{ needs.version.outputs.version_string }}"
262+ git tag "v$VERSION"
263+ git push origin "v$VERSION"
264+ tag_url="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/tree/v$VERSION"
265+ commit_url="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/commit/$GITHUB_SHA"
266+ echo "Tagged [\`v$VERSION\`]($tag_url) at [\`$(git rev-parse --short HEAD)\`]($commit_url)" >> $GITHUB_STEP_SUMMARY
267+
268+ github-release :
269+ if : ${{ github.event.inputs.production == 'true' && github.ref == 'refs/heads/main' }}
270+ runs-on : ubuntu-latest
271+ needs : [version, ios, android, tag]
272+ steps :
273+ - name : Checkout code
274+ uses : actions/checkout@v7.0.1
247275 - name : Download artifacts
248276 uses : actions/download-artifact@v8
249277 with :
0 commit comments