mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-08-16 21:34:01 +02:00
Use GITHUB_OUTPUT env var for setting job output
Also update some actions, and use my forks for the release ones.
This commit is contained in:
18
.github/prepare.py
vendored
18
.github/prepare.py
vendored
@@ -7,6 +7,10 @@ import sys
|
|||||||
ref = os.getenv('GITHUB_REF')
|
ref = os.getenv('GITHUB_REF')
|
||||||
publish_hostport = os.getenv('PUBLISH_HOSTPORT')
|
publish_hostport = os.getenv('PUBLISH_HOSTPORT')
|
||||||
|
|
||||||
|
def set_output(key, value):
|
||||||
|
with open(os.getenv('GITHUB_OUTPUT'), 'a') as f:
|
||||||
|
f.write(f"{key}={value}\n")
|
||||||
|
|
||||||
match_stable = re.fullmatch(r'refs/tags/v([0-9]+)\.([0-9]+)\.([0-9]+)', ref)
|
match_stable = re.fullmatch(r'refs/tags/v([0-9]+)\.([0-9]+)\.([0-9]+)', ref)
|
||||||
match_beta = re.fullmatch(r'refs/tags/v([0-9]+)\.([0-9]+)\.([0-9]+)b', ref)
|
match_beta = re.fullmatch(r'refs/tags/v([0-9]+)\.([0-9]+)\.([0-9]+)b', ref)
|
||||||
match_snapshot = re.fullmatch(r'refs/tags/snapshot-([0-9]+)', ref)
|
match_snapshot = re.fullmatch(r'refs/tags/snapshot-([0-9]+)', ref)
|
||||||
@@ -32,11 +36,11 @@ else:
|
|||||||
release_name = 'dev'
|
release_name = 'dev'
|
||||||
do_publish = publish_hostport and do_release
|
do_publish = publish_hostport and do_release
|
||||||
|
|
||||||
print('::set-output name=release_type::' + release_type)
|
set_output('release_type', release_type)
|
||||||
print('::set-output name=release_name::' + release_name)
|
set_output('release_name', release_name)
|
||||||
|
|
||||||
with open('.github/mod_id.txt') as f:
|
with open('.github/mod_id.txt') as f:
|
||||||
print('::set-output name=mod_id::' + f.read())
|
set_output('mod_id', f.read())
|
||||||
|
|
||||||
build_matrix = []
|
build_matrix = []
|
||||||
publish_matrix = []
|
publish_matrix = []
|
||||||
@@ -103,7 +107,7 @@ for bsh_host_arch, bsh_host_platform, bsh_host_libc, bsh_static_dynamic, bsh_bui
|
|||||||
'starcatcher_name': starcatcher_name,
|
'starcatcher_name': starcatcher_name,
|
||||||
})
|
})
|
||||||
|
|
||||||
print('::set-output name=build_matrix::' + json.dumps({ 'include': build_matrix }))
|
set_output('build_matrix', json.dumps({ 'include': build_matrix }))
|
||||||
print('::set-output name=publish_matrix::' + json.dumps({ 'include': publish_matrix }))
|
set_output('publish_matrix', json.dumps({ 'include': publish_matrix }))
|
||||||
print('::set-output name=do_release::' + (do_release and 'yes' or 'no'))
|
set_output('do_release', do_release and 'yes' or 'no')
|
||||||
print('::set-output name=do_publish::' + (do_publish and 'yes' or 'no'))
|
set_output('do_publish', do_publish and 'yes' or 'no')
|
||||||
|
24
.github/workflows/build.yaml
vendored
24
.github/workflows/build.yaml
vendored
@@ -25,8 +25,8 @@ jobs:
|
|||||||
mod_id: ${{ steps.prepare.outputs.mod_id }}
|
mod_id: ${{ steps.prepare.outputs.mod_id }}
|
||||||
do_publish: ${{ steps.prepare.outputs.do_publish }}
|
do_publish: ${{ steps.prepare.outputs.do_publish }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/setup-python@v2
|
- uses: actions/setup-python@v4
|
||||||
with:
|
with:
|
||||||
python-version: '3.10'
|
python-version: '3.10'
|
||||||
- id: prepare
|
- id: prepare
|
||||||
@@ -36,7 +36,7 @@ jobs:
|
|||||||
GITHUB_REF: ${{ github.ref }}
|
GITHUB_REF: ${{ github.ref }}
|
||||||
- if: steps.prepare.outputs.do_release == 'yes'
|
- if: steps.prepare.outputs.do_release == 'yes'
|
||||||
id: create_release
|
id: create_release
|
||||||
uses: actions/create-release@v1
|
uses: LBPHacker/create-release@v2
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
with:
|
with:
|
||||||
@@ -51,8 +51,8 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix: ${{ fromJSON(needs.prepare.outputs.build_matrix) }}
|
matrix: ${{ fromJSON(needs.prepare.outputs.build_matrix) }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/setup-python@v2
|
- uses: actions/setup-python@v4
|
||||||
with:
|
with:
|
||||||
python-version: '3.10'
|
python-version: '3.10'
|
||||||
- run: python -m pip install meson ninja
|
- run: python -m pip install meson ninja
|
||||||
@@ -80,7 +80,7 @@ jobs:
|
|||||||
ASSET_PATH: ${{ matrix.asset_path }}
|
ASSET_PATH: ${{ matrix.asset_path }}
|
||||||
DEBUG_ASSET_PATH: ${{ matrix.debug_asset_path }}
|
DEBUG_ASSET_PATH: ${{ matrix.debug_asset_path }}
|
||||||
SEPARATE_DEBUG: ${{ matrix.separate_debug }}
|
SEPARATE_DEBUG: ${{ matrix.separate_debug }}
|
||||||
- uses: actions/upload-release-asset@v1 # TODO-NTL: ship licenses
|
- uses: LBPHacker/upload-release-asset@v2 # TODO-NTL: ship licenses
|
||||||
if: needs.prepare.outputs.do_release == 'yes' && matrix.publish == 'yes'
|
if: needs.prepare.outputs.do_release == 'yes' && matrix.publish == 'yes'
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
@@ -89,7 +89,7 @@ jobs:
|
|||||||
asset_path: build/${{ matrix.asset_path }}
|
asset_path: build/${{ matrix.asset_path }}
|
||||||
asset_name: ${{ matrix.asset_name }}
|
asset_name: ${{ matrix.asset_name }}
|
||||||
asset_content_type: application/zip
|
asset_content_type: application/zip
|
||||||
- uses: actions/upload-release-asset@v1
|
- uses: LBPHacker/upload-release-asset@v2
|
||||||
if: needs.prepare.outputs.do_release == 'yes' && matrix.publish == 'yes' && matrix.separate_debug == 'yes'
|
if: needs.prepare.outputs.do_release == 'yes' && matrix.publish == 'yes' && matrix.separate_debug == 'yes'
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
@@ -98,12 +98,12 @@ jobs:
|
|||||||
asset_path: build/${{ matrix.debug_asset_path }}
|
asset_path: build/${{ matrix.debug_asset_path }}
|
||||||
asset_name: ${{ matrix.debug_asset_name }}
|
asset_name: ${{ matrix.debug_asset_name }}
|
||||||
asset_content_type: application/zip
|
asset_content_type: application/zip
|
||||||
- uses: actions/upload-artifact@v2
|
- uses: actions/upload-artifact@v3
|
||||||
if: matrix.artifact == 'yes'
|
if: matrix.artifact == 'yes'
|
||||||
with:
|
with:
|
||||||
path: build/${{ matrix.asset_path }}
|
path: build/${{ matrix.asset_path }}
|
||||||
name: ${{ matrix.asset_name }}
|
name: ${{ matrix.asset_name }}
|
||||||
- uses: actions/upload-artifact@v2
|
- uses: actions/upload-artifact@v3
|
||||||
if: matrix.artifact == 'yes' && matrix.separate_debug == 'yes'
|
if: matrix.artifact == 'yes' && matrix.separate_debug == 'yes'
|
||||||
with:
|
with:
|
||||||
path: build/${{ matrix.debug_asset_path }}
|
path: build/${{ matrix.debug_asset_path }}
|
||||||
@@ -116,8 +116,8 @@ jobs:
|
|||||||
matrix: ${{ fromJSON(needs.prepare.outputs.publish_matrix) }}
|
matrix: ${{ fromJSON(needs.prepare.outputs.publish_matrix) }}
|
||||||
if: needs.prepare.outputs.do_publish == 'yes'
|
if: needs.prepare.outputs.do_publish == 'yes'
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/download-artifact@v1
|
- uses: actions/download-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: ${{ matrix.asset_name }}
|
name: ${{ matrix.asset_name }}
|
||||||
- run: mv ${{ matrix.asset_name }}/${{ matrix.asset_path }} ${{ matrix.starcatcher_name }}
|
- run: mv ${{ matrix.asset_name }}/${{ matrix.asset_path }} ${{ matrix.starcatcher_name }}
|
||||||
@@ -133,7 +133,7 @@ jobs:
|
|||||||
needs: [build, publish, prepare]
|
needs: [build, publish, prepare]
|
||||||
if: needs.prepare.outputs.do_publish == 'yes'
|
if: needs.prepare.outputs.do_publish == 'yes'
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- run: ./.github/starcatcher-release.sh
|
- run: ./.github/starcatcher-release.sh
|
||||||
env:
|
env:
|
||||||
RELEASE_NAME: ${{ needs.prepare.outputs.release_name }}
|
RELEASE_NAME: ${{ needs.prepare.outputs.release_name }}
|
||||||
|
Reference in New Issue
Block a user