-
-
Notifications
You must be signed in to change notification settings - Fork 35
106 lines (87 loc) · 3.36 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
name: Build and Release
on:
push:
branches:
- main # Change this to your main branch
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Print current directory
run: pwd
# Extract previous release version
- name: Extract previous release version
id: extract_previous_version
run: |
previous_tag=$(git describe --abbrev=0 --tags)
previous_version=$(echo "${previous_tag}" | sed 's/V//')
echo "::set-output name=previous_version::${previous_version}"
# Increment version
- name: Increment version
id: increment_version
run: |
major=$(echo "${{ steps.extract_previous_version.outputs.previous_version }}" | cut -d'.' -f1)
minor=$(echo "${{ steps.extract_previous_version.outputs.previous_version }}" | cut -d'.' -f2)
new_minor=$((minor + 1))
new_version="${major}.${new_minor}.0_beta"
echo "::set-output name=new_version::${new_version}"
# Set new version
- name: Set new version
run: echo "export APP_VERSION=${{ steps.increment_version.outputs.new_version }}" >> $GITHUB_ENV
# Setup Node.js
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '17'
# Set up PHP
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
# Install Composer dependencies
- name: Install Composer dependencies
run: composer install --no-dev --optimize-autoloader
# Install npm dependencies
- name: Install npm dependencies
run: npm install
# Build assets with npm
- name: Build assets with npm
run: npm run build
# Copy .env.example to .env
- name: Copy .env.example to .env
run: cp .env.example .env
# Tar project contents with version
- name: Tar project contents with version
run: |
version=${{ steps.increment_version.outputs.new_version }}
zip -r "cssbans_${version}.zip" .
# Download previous release artifacts
- name: Download previous release artifacts
uses: actions/download-artifact@v2
with:
name: ${{ steps.get_previous_release_tag.outputs.previous_tag }}
path: previous_release
- name: List contents of previous_release
run: ls -l previous_release
- name: Set Git user identity
run: |
git config --global user.email "[email protected]"
git config --global user.name "hobsRKM"
# Create tag for new version
- name: Create tag for new version
run: git tag -a "v${{ steps.increment_version.outputs.new_version }}" -m "Release v${{ steps.increment_version.outputs.new_version }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Upload zip file to release
- name: Upload tar file to release
uses: actions/upload-artifact@v2
with:
name: project
path: cssbans_*.zip
# Copy previous release artifacts to new release
- name: Copy previous release artifacts to new release
run: cp previous_release/serverlistplayersfix_windows.zip . && cp previous_release/serverlistplayersfix_linux.zip .