-
Notifications
You must be signed in to change notification settings - Fork 1
60 lines (51 loc) · 1.68 KB
/
build.yaml
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
name: Build and Release
on: push
jobs:
build-and-release:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- windows-latest
- ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 16
- name: Install dependencies
run: npm install
- name: Build the project
run: npm run bundle
- name: Check if Tag Exists
id: check_tag
run: |
version=$(node -e "console.log(require('./package.json').version)")
tag_exists=$(git ls-remote --tags origin "refs/tags/v$version")
if [ -z "$tag_exists" ]; then
echo "Tag does not exist. Creating tag..."
git config --global user.email "[email protected]"
git config --global user.name "${{ github.actor }}"
git tag -a -m "Tag for version $version" "v$version"
git push origin "v$version"
else
echo "Tag v$version already exists."
fi
echo "::set-output name=tag_name::v$version"
shell: bash
- name: Determine Artifact File
id: determine_artifact
run: |
if [ "${{ runner.os }}" == "Windows" ]; then
echo "::set-output name=artifact_file::haax-mpq.exe"
else
echo "::set-output name=artifact_file::haax-mpq"
fi
shell: bash
- name: Release
uses: softprops/action-gh-release@v1
with:
files: ${{ steps.determine_artifact.outputs.artifact_file }}
tag_name: ${{ steps.check_tag.outputs.tag_name }}