mirror of
https://github.com/yairm210/Unciv.git
synced 2025-08-03 08:39:37 +07:00
get tag from github actions, the 2022 way
This commit is contained in:
45
.github/workflows/buildAndDeploy.yml
vendored
45
.github/workflows/buildAndDeploy.yml
vendored
@ -13,17 +13,16 @@ on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
get-tag-and-release-body:
|
||||
get-release-body:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
outputs:
|
||||
version_tag: ${{ steps.tag.outputs.tag }}
|
||||
release_body: ${{ steps.read_release.outputs.release_body }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Get release tag # We can then get the tag using ${{steps.tag.outputs.tag}} as below
|
||||
- name: Get release tag
|
||||
id: tag
|
||||
uses: dawidd6/action-get-tag@v1
|
||||
|
||||
@ -33,7 +32,7 @@ jobs:
|
||||
shell: bash
|
||||
run: |
|
||||
## To test this in Windows PS: cat .\changelog.md | wsl grep -Pzo --color '\\#{2}.3.15.7[^\\#]*?\\#{2}' | wsl head -n -2
|
||||
r=$(grep -Pzo '\#{2}.${{steps.tag.outputs.tag}}[^\#]*\#' changelog.md) # grep to get only our release
|
||||
r=$(grep -Pzo '\#{2}.$${{ github.ref_name }}[^\#]*\#' changelog.md) # grep to get only our release
|
||||
r=$(echo "$r" | head -n -2 | tail -n +3)
|
||||
|
||||
## See https://trstringer.com/github-actions-multiline-strings/
|
||||
@ -47,7 +46,7 @@ jobs:
|
||||
|
||||
build-jar:
|
||||
runs-on: ubuntu-latest
|
||||
needs: get-tag-and-release-body
|
||||
needs: get-release-body
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
@ -106,7 +105,7 @@ jobs:
|
||||
android-build:
|
||||
continue-on-error: true
|
||||
runs-on: ubuntu-latest
|
||||
needs: get-tag-and-release-body
|
||||
needs: get-release-body
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
@ -122,7 +121,7 @@ jobs:
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir whatsNewDirectory
|
||||
echo "${{needs.get-tag-and-release-body.outputs.release_body}}" > whatsNewDirectory/whatsnew-en-US
|
||||
echo "${{needs.get-release-body.outputs.release_body}}" > whatsNewDirectory/whatsnew-en-US
|
||||
./gradlew :android:bundleRelease
|
||||
./gradlew :android:assembleRelease
|
||||
|
||||
@ -214,7 +213,7 @@ jobs:
|
||||
|
||||
upload-to-itch:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [get-tag-and-release-body, packr-build] # build required for tag and version
|
||||
needs: [packr-build]
|
||||
continue-on-error: true
|
||||
steps:
|
||||
|
||||
@ -231,12 +230,12 @@ jobs:
|
||||
unzip butler.zip
|
||||
chmod +x butler
|
||||
|
||||
./butler push Unciv-Linux64.zip yairm210/unciv:Linux64 --userversion ${{needs.get-tag-and-release-body.outputs.version_tag}}
|
||||
./butler push Unciv-Windows64.zip yairm210/unciv:Windows64 --userversion ${{needs.get-tag-and-release-body.outputs.version_tag}}
|
||||
./butler push Unciv-Linux64.zip yairm210/unciv:Linux64 --userversion ${{ github.ref_name }}
|
||||
./butler push Unciv-Windows64.zip yairm210/unciv:Windows64 --userversion ${{ github.ref_name }}
|
||||
|
||||
upload-to-steam:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [get-tag-and-release-body, packr-build] # build required for tag and version
|
||||
needs: [packr-build]
|
||||
continue-on-error: true
|
||||
steps:
|
||||
|
||||
@ -261,14 +260,14 @@ jobs:
|
||||
ssfnFileName: ${{ secrets.STEAM_SSFN_FILE_NAME }}
|
||||
ssfnFileContents: ${{ secrets.STEAM_SSFN_FILE_CONTENTS }}
|
||||
appId: 2118950
|
||||
buildDescription: ${{steps.tag.outputs.tag}}
|
||||
buildDescription: ${{ github.ref_name }}
|
||||
rootPath: steam
|
||||
depot1Path: Unciv-Windows64
|
||||
depot2Path: Unciv-Linux64
|
||||
releaseBranch: release
|
||||
|
||||
upload-github-release-and-post-to-discord:
|
||||
needs: [get-tag-and-release-body, android-build, packr-build]
|
||||
needs: [get-release-body, android-build, packr-build]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
|
||||
@ -288,7 +287,7 @@ jobs:
|
||||
- name: Check if this is a real release or a test version, for Github release
|
||||
id: check-version-tag
|
||||
run: |
|
||||
if [[ ${{needs.get-tag-and-release-body.outputs.version_tag}} =~ [0-9]\.[0-9]+\.[0-9]+ ]]; then
|
||||
if [[ ${{ github.ref_name }} =~ [0-9]\.[0-9]+\.[0-9]+ ]]; then
|
||||
echo "real_release=true" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
@ -305,34 +304,34 @@ jobs:
|
||||
# <--- Use environment variables that was created earlier - see https://github.com/svenstaro/upload-release-action
|
||||
# Single-quotes do not solve the multiline problem.
|
||||
body: |
|
||||
## ${{needs.get-tag-and-release-body.outputs.version_tag}}
|
||||
## ${{ github.ref_name }}
|
||||
|
||||
${{needs.get-tag-and-release-body.outputs.release_body}}
|
||||
${{needs.get-release-body.outputs.release_body}}
|
||||
|
||||
- name: Post announcement on Discord
|
||||
continue-on-error: true
|
||||
## On patch releases, don't notify Discord
|
||||
if: needs.get-tag-and-release-body.outputs.release_body != ''
|
||||
if: needs.get-release-body.outputs.release_body != ''
|
||||
env:
|
||||
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
|
||||
uses: Ilshidur/action-discord@0.3.2
|
||||
with:
|
||||
args: | # See https://discordjs.guide/miscellaneous/parsing-mention-arguments.html#how-discord-mentions-work
|
||||
<@&663705024265715743>
|
||||
*${{needs.get-tag-and-release-body.outputs.version_tag}} rolling out!*
|
||||
*${{ github.ref_name }} rolling out!*
|
||||
|
||||
${{needs.get-tag-and-release-body.outputs.release_body}}
|
||||
${{needs.get-release-body.outputs.release_body}}
|
||||
|
||||
AUR-update:
|
||||
continue-on-error: true
|
||||
runs-on: ubuntu-latest
|
||||
needs: [get-tag-and-release-body, upload-github-release-and-post-to-discord]
|
||||
needs: [get-release-body, upload-github-release-and-post-to-discord]
|
||||
steps:
|
||||
|
||||
- name: Get AUR PKGBUILD
|
||||
run: |
|
||||
curl --silent --output PKGBUILD 'https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=unciv-bin'
|
||||
sed -E -e "s#(_pkgver=).*#\1${{needs.get-tag-and-release-body.outputs.version_tag}}#" -e "s#(pkgrel=).*#\10#" -i PKGBUILD
|
||||
sed -E -e "s#(_pkgver=).*#\1${{ github.ref_name }}#" -e "s#(pkgrel=).*#\10#" -i PKGBUILD
|
||||
|
||||
- name: Publish AUR package
|
||||
uses: Thyrum/github-actions-deploy-aur@master
|
||||
@ -343,9 +342,9 @@ jobs:
|
||||
commit_email: ${{ secrets.AUR_COMMIT_EMAIL }}
|
||||
ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
|
||||
commit_message: |
|
||||
Update to ${{needs.get-tag-and-release-body.outputs.version_tag}}
|
||||
Update to ${{ github.ref_name }}
|
||||
|
||||
${{needs.get-tag-and-release-body.outputs.release_body}}
|
||||
${{needs.get-release-body.outputs.release_body}}
|
||||
ssh_keyscan_types: rsa,dsa,ecdsa,ed25519
|
||||
updpkgsums: true
|
||||
allow_empty_commits: false
|
||||
|
Reference in New Issue
Block a user