-
Notifications
You must be signed in to change notification settings - Fork 0
121 lines (118 loc) · 4.35 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
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