Update workflow. #12
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Main | |
on: | |
push: | |
branches: | |
- '**' # All branch names including slashes. | |
- '!gh-pages' # Except for gh-pages. | |
tags: | |
- 'v[0-9]+.[0-9]+.[0-9]+' | |
pull_request: | |
branches: | |
- '**' # All branch names including slashes. | |
- '!gh-pages' # Except for gh-pages. | |
workflow_dispatch: # Allows you to run this workflow manually from the Actions tab. | |
env: | |
MUSHCLIENT_BINARIES: ${{ secrets.MUSHCLIENT_BINARIES }} | |
jobs: | |
build: | |
name: Build And Test | |
runs-on: windows-2022 | |
defaults: | |
run: | |
shell: cmd | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # All history for all branches and tags. | |
submodules: 'recursive' # All submodules. | |
- name: Cache Binary Archive | |
id: cache_binaries | |
uses: actions/cache@v4 | |
with: | |
key: mushclient-bin-${{ env.ImageOS }}${{ runner.arch }}-${{ env.ImageVersion }}-${{ hashFiles('**/mushclient-mume-binaries.zip.sha256') }} | |
path: mushclient-mume-binaries.zip | |
- name: Download Binaries | |
if: steps.cache_binaries.outputs.cache-hit != 'true' | |
shell: bash | |
run: | | |
curl --location --output "mushclient-mume-binaries.zip" "${MUSHCLIENT_BINARIES}" | |
echo Verifying checksum. | |
sha256sum -c "mushclient-mume-binaries.zip.sha256" | |
- name: Extract Binaries and Merge Source | |
run: | | |
echo Extracting binaries. | |
7z x -y -tzip "mushclient-mume-binaries.zip" | |
echo Merging source code. | |
git archive --format tar --prefix "mushclient-mume/" HEAD | 7z x -y -ttar -si | |
if exist "pax_global_header" del /q /f "pax_global_header" | |
- name: Run Lua Tests | |
run: | | |
"mushclient-mume\test.bat" | |
deploy: | |
needs: build | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | |
name: Deploy Release | |
runs-on: windows-2022 | |
permissions: | |
contents: write | |
defaults: | |
run: | |
shell: cmd | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # All history for all branches and tags. | |
submodules: 'recursive' # All submodules. | |
- name: Get Project Info | |
id: project_info | |
shell: bash | |
run: | | |
NAME='MUSHclient MUME' | |
VERSION=${GITHUB_REF#refs/tags/v} # Everything after the v. | |
echo "name=${NAME}" >> $GITHUB_OUTPUT | |
echo "version=${VERSION}" >> $GITHUB_OUTPUT | |
- name: Cache Binary Archive | |
id: cache_binaries | |
uses: actions/cache@v4 | |
with: | |
key: mushclient-bin-${{ env.ImageOS }}${{ runner.arch }}-${{ env.ImageVersion }}-${{ hashFiles('**/mushclient-mume-binaries.zip.sha256') }} | |
path: mushclient-mume-binaries.zip | |
- name: Download Binaries | |
if: steps.cache_binaries.outputs.cache-hit != 'true' | |
shell: bash | |
run: | | |
curl --location --output "mushclient-mume-binaries.zip" "${MUSHCLIENT_BINARIES}" | |
echo Verifying checksum. | |
sha256sum -c "mushclient-mume-binaries.zip.sha256" | |
- name: Extract Binaries and Merge Source | |
run: | | |
echo Extracting binaries. | |
7z x -y -tzip "mushclient-mume-binaries.zip" | |
echo Merging source code. | |
git archive --format tar --prefix "mushclient-mume/" HEAD | 7z x -y -ttar -si | |
if exist "pax_global_header" del /q /f "pax_global_header" | |
- name: Create Bundle | |
shell: bash | |
env: | |
ZIP_FILE: mushclient-mume-v${{ steps.project_info.outputs.version }}.zip | |
run: | | |
rm -rf "mushclient-mume/.git*" | |
rm -f "mushclient-mume/mushclient-mume-binaries.zip.sha256" | |
7z a -y -tzip "${ZIP_FILE}" "mushclient-mume" | |
sha256sum "${ZIP_FILE}" >"${ZIP_FILE}.sha256" | |
rm -rf "mushclient-mume" | |
- name: Create Release | |
id: create_release | |
uses: softprops/action-gh-release@v2 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} # Automatically provided by Actions. | |
name: ${{ steps.project_info.outputs.name }} Version ${{ steps.project_info.outputs.version }} | |
body: Auto-generated release. | |
draft: false | |
prerelease: false | |
fail_on_unmatched_files: true | |
files: | | |
mushclient-mume-v*.zip | |
mushclient-mume-v*.zip.sha256 |