-
-
Notifications
You must be signed in to change notification settings - Fork 26
139 lines (123 loc) · 4.26 KB
/
release.yml
File metadata and controls
139 lines (123 loc) · 4.26 KB
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
name: Release
on:
push:
tags: ["*.*.*"]
env:
CARGO_TERM_COLOR: always
jobs:
build-binaries:
name: Build binaries
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
name: gdscript-formatter-${{ github.ref_name }}-linux-x86_64
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
name: gdscript-formatter-${{ github.ref_name }}-linux-aarch64
- target: x86_64-apple-darwin
os: macos-latest
name: gdscript-formatter-${{ github.ref_name }}-macos-x86_64
- target: aarch64-apple-darwin
os: macos-latest
name: gdscript-formatter-${{ github.ref_name }}-macos-aarch64
- target: x86_64-pc-windows-msvc
os: windows-latest
name: gdscript-formatter-${{ github.ref_name }}-windows-x86_64.exe
- target: aarch64-pc-windows-msvc
os: windows-latest
name: gdscript-formatter-${{ github.ref_name }}-windows-aarch64.exe
runs-on: ${{ matrix.os }}
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
# This is a toolchain to build cross-platform binaries with rust. We use
# it for other architectures and OSes than the build runner's.
- name: Install cross
if: matrix.os == 'ubuntu-latest' && matrix.target != 'x86_64-unknown-linux-gnu'
run: cargo install cross --git https://github.com/cross-rs/cross
# Build either with cross or cargo, depending on the target.
- name: Build binary
run: |
if [[ "${{ matrix.os }}" == "ubuntu-latest" && "${{ matrix.target }}" != "x86_64-unknown-linux-gnu" ]]; then
cross build --verbose --locked --release --target ${{ matrix.target }}
else
cargo build --verbose --locked --release --target ${{ matrix.target }}
fi
shell: bash
- name: Move and rename binary
run: |
if [[ "${{ matrix.os }}" == "windows-latest" ]]; then
mv target/${{ matrix.target }}/release/gdscript-formatter.exe ${{ matrix.name }}
else
mv target/${{ matrix.target }}/release/gdscript-formatter ${{ matrix.name }}
fi
shell: bash
- name: Compress to ZIP (All platforms)
run: |
if [[ "${{ matrix.os }}" == "windows-latest" ]]; then
7z a ${{ matrix.name }}.zip ${{ matrix.name }}
else
zip ${{ matrix.name }}.zip ${{ matrix.name }}
fi
shell: bash
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.name }}
path: ${{ matrix.name }}.zip
if-no-files-found: error
package-godot-addon:
name: Package the Godot add-on
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Create godot-addon.zip
run: |
zip -r godot-addon.zip addons/
shell: bash
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: godot-addon
path: godot-addon.zip
if-no-files-found: error
publish-release:
name: Publish release
needs:
- build-binaries
- package-godot-addon
runs-on: ubuntu-latest
permissions:
contents: write
if: ${{ success() }}
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Create/Update Release
uses: softprops/action-gh-release@v2
with:
name: GDScript formatter ${{ github.ref_name }}
body: |
A fast code formatter for GDScript in Godot 4.
You can learn how to install, use, configure, and integrate the formatter into your workflow on this page:
https://www.gdquest.com/library/gdscript_formatter/
files: |
artifacts/**/*.zip
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}