forked from godotjs/javascript
-
Notifications
You must be signed in to change notification settings - Fork 0
85 lines (77 loc) · 2.41 KB
/
release_builds.yml
File metadata and controls
85 lines (77 loc) · 2.41 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
name: 🦅 Release Builds
on:
workflow_call:
inputs:
version:
required: true
type: string
concurrency:
group: ci-${{github.actor}}-${{github.head_ref || github.run_number}}-${{github.ref}}-android
cancel-in-progress: true
permissions:
contents: write
jobs:
rename:
runs-on: ubuntu-latest
steps:
- name: ⏬ Checkout repo
uses: actions/checkout@v4
- name: 📛 Add version to release name
uses: actions/github-script@v6
with:
result-encoding: json
script: |
const { repo, owner } = context.repo;
const date = new Date();
const year = date.getFullYear().toString();
const month = (date.getMonth() + 1).toString().padStart(2,"0");
const day = (date.getDay() + 1).toString().padStart(2,"0");
await github.rest.repos.updateRelease({
owner,
repo,
release_id: context.payload.release.id,
name: '${{ inputs.version }}-' + context.payload.release.name + '-' + year + month + day,
});
release:
runs-on: ubuntu-latest
name: ${{ matrix.name }}
strategy:
fail-fast: false
matrix:
name:
- android-template
- ios-template
- linux-editor-mono
- linux-template-minimal
- linux-template-mono
- macos-editor
- macos-template
- web-template
- windows-editor
- windows-template
steps:
- name: ⏬ Checkout repo
uses: actions/checkout@v4
- name: ⏬ Download build
uses: actions/download-artifact@v3
with:
name: ${{ matrix.name }}
path: ${{ matrix.name }}
- name: 📦 Pack build as zip
run: zip -r ${{ matrix.name }}.zip ${{ matrix.name }}
shell: bash
- name: ⏫ Upload Release Asset
id: upload-release-asset
uses: actions/github-script@v6
with:
result-encoding: json
script: |
const FS = require('node:fs')
const { repo, owner } = context.repo;
return await github.rest.repos.uploadReleaseAsset({
owner,
repo,
release_id: context.payload.release.id,
name: '${{ matrix.name }}.zip',
data: FS.readFileSync('${{ github.workspace }}/${{ matrix.name }}.zip')
});