This repository has been archived by the owner on Mar 7, 2023. It is now read-only.
forked from elizagamedev/mkxp-oneshot
-
Notifications
You must be signed in to change notification settings - Fork 9
160 lines (156 loc) · 5.49 KB
/
ci.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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
name: ModShot CI
on:
workflow_dispatch:
pull_request:
push:
tags:
- "v*"
branches:
- master
jobs:
build-linux:
name: Build ModShot for Linux
runs-on: ubuntu-latest
strategy:
matrix:
ruby_ver: ['3.1', '3.0', '2.7']
steam: [true, false]
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v2
- name: Shorten SHA signature
run: echo "SHA7=`echo ${GITHUB_SHA} | cut -c1-7`" >> $GITHUB_ENV
- name: Install dependencies
working-directory: ${{ github.workspace }}
run: |
sudo apt update
bash setup.sh
pip3 install meson ninja
- name: Build Ruby ${{ matrix.ruby_ver }}
working-directory: ${{ github.workspace }}
run: cd linux; make RUBY_VER=${{ matrix.ruby_ver }}
- name: Build ModShot
working-directory: ${{ github.workspace }}
run: |
cd linux; source vars.sh; cd ..
meson build --prefix=$PWD/out -Dmri_version=${{ matrix.ruby_ver }} -Dsteam=${{ matrix.steam }}
cd build; ninja install
- name: Prepare artifact
run: |
mkdir ${{ runner.temp }}/artifact
mv ${{ github.workspace }}/out/* ${{ runner.temp }}/artifact/
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: ModShot_Linux_${{ env.SHA7 }}_Ruby-${{ matrix.ruby_ver }}_Steam-${{ matrix.steam }}
path: ${{ runner.temp }}/artifact
build-windows:
name: Build ModShot for Windows
runs-on: windows-latest
needs: build-linux
strategy:
fail-fast: false
matrix:
ruby_ver: ['3.0', '2.7']
sys: ['mingw64']
steam: [true, false]
include:
- sys: 'ucrt64'
ruby_ver: '3.1'
steam: true
- sys: 'ucrt64'
ruby_ver: '3.1'
steam: false
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup MSYS2
uses: msys2/setup-msys2@v2
with:
msystem: ${{ matrix.sys }}
- name: Shorten SHA signature
shell: msys2 {0}
run: echo "SHA7=`echo ${GITHUB_SHA} | cut -c1-7`" >> $GITHUB_ENV
- name: Install packages
shell: msys2 {0}
run: pacman -S --noconfirm mm-common autoconf automake gcc make cmake libtool
- name: Install dependencies
shell: msys2 {0}
working-directory: ${{ github.workspace }}
run: bash setup.sh
- name: Build Ruby ${{ matrix.ruby_ver }}
shell: msys2 {0}
working-directory: ${{ github.workspace }}
run: cd windows; make RUBY_VER=${{ matrix.ruby_ver }}
- name: Build ModShot
shell: msys2 {0}
working-directory: ${{ github.workspace }}
run: |
cd windows; source vars.sh; cd ..
meson build --prefix=$PWD/out -Dmri_version=${{ matrix.ruby_ver }} -Dsteam=${{ matrix.steam }}
cd build; ninja install
- name: Prepare artifact
run: |
mkdir ${{ runner.temp }}\artifact
move ${{ github.workspace }}\out\* ${{ runner.temp }}\artifact\
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: ModShot_Windows_${{ env.SHA7 }}_Ruby-${{ matrix.ruby_ver }}-${{ matrix.sys }}_Steam-${{ matrix.steam }}
path: ${{ runner.temp }}\artifact
release-dev:
name: Release ModShot (dev)
needs: build-windows
runs-on: ubuntu-latest
if: ${{ !startsWith(github.ref, 'refs/tags/v') && github.event_name != 'pull_request' }}
steps:
- name: Set environment variables
run: echo "SHA7=`echo ${GITHUB_SHA} | cut -c1-7`" >> $GITHUB_ENV
- name: Create directory for artifacts
run: mkdir ${{ runner.temp }}/artifacts
- name: Download artifacts
uses: dawidd6/action-download-artifact@v2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
workflow: ci.yml
workflow_conclusion: success
path: ${{ runner.temp }}/artifacts
skip_unpack: true
- name: Release ModShot
uses: marvinpinto/action-automatic-releases@latest
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
title: ModShot ${{ env.SHA7 }}-dev
prerelease: true
automatic_release_tag: latest
files: ${{ runner.temp }}/artifacts/*.zip
release-tagged:
name: Release ModShot (tagged)
needs: build-windows
runs-on: ubuntu-latest
if: ${{ startsWith(github.ref, 'refs/tags/v') && github.event_name != 'pull_request' }}
steps:
- name: Set environment variables
run: |
echo "SHA7=`echo ${GITHUB_SHA} | cut -c1-7`" >> $GITHUB_ENV
echo "RELEASE_VER=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Create directory for artifacts
run: mkdir ${{ runner.temp }}/artifacts
- name: Download artifacts
uses: dawidd6/action-download-artifact@v2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
workflow: ci.yml
workflow_conclusion: success
path: ${{ runner.temp }}/artifacts
skip_unpack: true
- name: Release ModShot
uses: marvinpinto/action-automatic-releases@latest
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
title: ModShot ${{ env.RELEASE_VER }}-${{ env.SHA7 }}
prerelease: false
automatic_release_tag: ${{ env.RELEASE_VER }}
files: ${{ runner.temp }}/artifacts/*.zip