mirror of
https://github.com/CraftyBoss/SuperMarioOdysseyOnline.git
synced 2024-11-25 04:35:17 +00:00
github workflow to build and release
This commit is contained in:
parent
3325c50c00
commit
71ff477bb9
5 changed files with 210 additions and 0 deletions
40
.github/actions/attach/action.yml
vendored
Normal file
40
.github/actions/attach/action.yml
vendored
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
name: Attach build artifacts to release
|
||||||
|
|
||||||
|
|
||||||
|
inputs:
|
||||||
|
filename:
|
||||||
|
description : 'Filename of the build artifact'
|
||||||
|
required : true
|
||||||
|
upload_url:
|
||||||
|
description : 'Upload URL of the release'
|
||||||
|
required : true
|
||||||
|
GITHUB_TOKEN:
|
||||||
|
description : 'Secret GitHub token required for uploading to the release'
|
||||||
|
required : true
|
||||||
|
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: composite
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name : Download artifacts
|
||||||
|
uses : actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
name : ${{ inputs.filename }}
|
||||||
|
path : ./starlight_patch_100/
|
||||||
|
-
|
||||||
|
name : Zip artifacts
|
||||||
|
shell : bash
|
||||||
|
run: |
|
||||||
|
cd ./starlight_patch_100/
|
||||||
|
zip -rmT9 ${{ inputs.filename }}.zip ./*
|
||||||
|
-
|
||||||
|
name : Attach to release
|
||||||
|
uses : actions/upload-release-asset@v1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ inputs.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
upload_url : ${{ inputs.upload_url }}
|
||||||
|
asset_path : ./starlight_patch_100/${{ inputs.filename }}.zip
|
||||||
|
asset_name : ${{ inputs.filename }}.zip
|
||||||
|
asset_content_type : application/zip
|
61
.github/actions/build/action.yml
vendored
Normal file
61
.github/actions/build/action.yml
vendored
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
name: Build artifacts
|
||||||
|
|
||||||
|
|
||||||
|
inputs:
|
||||||
|
tag:
|
||||||
|
description : 'version tag'
|
||||||
|
required : false
|
||||||
|
default : ''
|
||||||
|
|
||||||
|
|
||||||
|
outputs:
|
||||||
|
filename:
|
||||||
|
description : 'Filename for the build artifacts'
|
||||||
|
value : ${{ steps.env.outputs.filename }}
|
||||||
|
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: composite
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name : Environment
|
||||||
|
id : env
|
||||||
|
shell : bash
|
||||||
|
run: |
|
||||||
|
VERS=${{ inputs.tag }}
|
||||||
|
echo "::set-output name=version::${VERS:1}"
|
||||||
|
echo "::set-output name=filename::SMO_Online${{ (inputs.tag != '' && format('_{0}', inputs.tag)) || '' }}"
|
||||||
|
-
|
||||||
|
name : Set up Docker Buildx
|
||||||
|
uses : docker/setup-buildx-action@v2
|
||||||
|
-
|
||||||
|
name : Build environment
|
||||||
|
uses : docker/build-push-action@v3
|
||||||
|
with:
|
||||||
|
pull : true
|
||||||
|
push : false
|
||||||
|
load : true
|
||||||
|
context : .
|
||||||
|
file : ./Dockerfile
|
||||||
|
tags : smoo-build-env
|
||||||
|
platforms : linux/amd64
|
||||||
|
cache-from : type=gha,scope=smoo-build-env
|
||||||
|
cache-to : type=gha,scope=smoo-build-env,mode=max
|
||||||
|
-
|
||||||
|
name : Build mod
|
||||||
|
shell : bash
|
||||||
|
run: |
|
||||||
|
docker run --rm \
|
||||||
|
-u `id -u`:`id -g` \
|
||||||
|
-v "/$PWD/":/app/ \
|
||||||
|
${{ (steps.env.outputs.version != '' && format('-e BUILDVER={0}', steps.env.outputs.version)) || '' }} \
|
||||||
|
smoo-build-env \
|
||||||
|
;
|
||||||
|
cp -r ./romfs/ ./starlight_patch_100/atmosphere/contents/0100000000010000/.
|
||||||
|
-
|
||||||
|
name : Upload artifacts
|
||||||
|
uses : actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name : ${{ steps.env.outputs.filename }}
|
||||||
|
path : ./starlight_patch_100/
|
||||||
|
if-no-files-found : error
|
36
.github/actions/release/action.yml
vendored
Normal file
36
.github/actions/release/action.yml
vendored
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
name: Create release
|
||||||
|
|
||||||
|
|
||||||
|
inputs:
|
||||||
|
tag:
|
||||||
|
description : 'Version tag'
|
||||||
|
required : true
|
||||||
|
GITHUB_TOKEN:
|
||||||
|
description : 'Secret GitHub token required to create the release'
|
||||||
|
required : true
|
||||||
|
|
||||||
|
|
||||||
|
outputs:
|
||||||
|
id:
|
||||||
|
value: ${{ steps.release.outputs.id }}
|
||||||
|
html_url:
|
||||||
|
value: ${{ steps.release.outputs.html_url }}
|
||||||
|
upload_url:
|
||||||
|
value: ${{ steps.release.outputs.upload_url }}
|
||||||
|
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: composite
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name : Create release
|
||||||
|
id : release
|
||||||
|
uses : actions/create-release@v1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ inputs.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
tag_name : ${{ inputs.tag }}
|
||||||
|
release_name : Release ${{ inputs.tag }}
|
||||||
|
body : ''
|
||||||
|
draft : true
|
||||||
|
prerelease : false
|
26
.github/workflows/build.yml
vendored
Normal file
26
.github/workflows/build.yml
vendored
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
name: Build
|
||||||
|
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- '**'
|
||||||
|
tags:
|
||||||
|
- '**'
|
||||||
|
- '!v[0-9]+.[0-9]+.[0-9]+'
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- '**'
|
||||||
|
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name : Checkout
|
||||||
|
uses : actions/checkout@v3
|
||||||
|
-
|
||||||
|
name : Build artifacts
|
||||||
|
uses : ./.github/actions/build
|
47
.github/workflows/release.yml
vendored
Normal file
47
.github/workflows/release.yml
vendored
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
name: Release
|
||||||
|
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- 'v[0-9]+.[0-9]+.[0-9]+'
|
||||||
|
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
filename: ${{ steps.build.outputs.filename }}
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name : Checkout
|
||||||
|
uses : actions/checkout@v3
|
||||||
|
-
|
||||||
|
name : Build artifacts
|
||||||
|
id : build
|
||||||
|
uses : ./.github/actions/build
|
||||||
|
with:
|
||||||
|
tag : ${{ github.ref_name }}
|
||||||
|
|
||||||
|
release:
|
||||||
|
needs: build
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
name : Checkout
|
||||||
|
uses : actions/checkout@v3
|
||||||
|
-
|
||||||
|
name : Create release
|
||||||
|
id : release
|
||||||
|
uses : ./.github/actions/release
|
||||||
|
with:
|
||||||
|
tag : ${{ github.ref_name }}
|
||||||
|
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
-
|
||||||
|
name : Attach build artifacts to release
|
||||||
|
uses : ./.github/actions/attach
|
||||||
|
with:
|
||||||
|
filename : ${{ needs.build.outputs.filename }}
|
||||||
|
upload_url : ${{ steps.release.outputs.upload_url }}
|
||||||
|
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
|
Loading…
Reference in a new issue