ci: add fixed short link for released version eg v90.mcraft.fun

This commit is contained in:
Vitaly Turovsky 2025-04-29 04:22:59 +03:00
commit 5bf66b8e50
3 changed files with 21 additions and 2 deletions

View file

@ -1,4 +1,4 @@
name: Vercel Deploy Preview
name: Vercel PR Deploy (Preview)
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}

View file

@ -29,6 +29,9 @@ jobs:
run: pnpx zardoy-release empty --skip-github --output-file assets/release.json
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Get releasing alias
run: node scripts/githubActions.mjs getReleasingAlias
id: alias
- name: Download Generated Sounds map
run: node scripts/downloadSoundsMap.mjs
- run: vercel build --token=${{ secrets.VERCEL_TOKEN }} --prod
@ -45,6 +48,12 @@ jobs:
with:
run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }} --prod
id: deploy
- name: Set deployment alias
if: ${{ steps.alias.outputs.alias != '' && steps.alias.outputs.alias != 'mcraft.fun' && steps.alias.outputs.alias != 's.mcraft.fun' }}
run: |
for alias in $(echo ${{ steps.alias.outputs.alias }} | tr "," "\n"); do
vercel alias set ${{ steps.deploy.outputs.stdout }} $alias --token=${{ secrets.VERCEL_TOKEN }} --scope=zaro
done
# publish to github
- run: cp vercel.json .vercel/output/static/vercel.json
- uses: peaceiris/actions-gh-pages@v3
@ -70,7 +79,7 @@ jobs:
zip -r ../self-host.zip .
- run: |
pnpx zardoy-release node --footer "This release URL: ${{ steps.deploy.outputs.stdout }}"
pnpx zardoy-release node --footer "This release URL: $(echo ${{ steps.alias.outputs.alias }} | cut -d',' -f1) (Vercel URL: ${{ steps.deploy.outputs.stdout }})"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# has possible output: tag

View file

@ -15,6 +15,16 @@ const fns = {
// set github output
setOutput('alias', alias[1])
}
},
getReleasingAlias() {
const final = (ver) => `${ver}.mcraft.fun,${ver}.pcm.gg`
const releaseJson = JSON.parse(fs.readFileSync('./assets/release.json', 'utf8'))
const tag = releaseJson.latestTag
const [major, minor, patch] = tag.replace('v', '').split('.')
if (major === '0' && minor === '1') {
return final(`v${patch}`)
}
return final(tag)
}
}