Skip to content

Commit 5cd5a28

Browse files
authored
feat(ci): Initial GA workflow support (#2)
1 parent e26f5b9 commit 5cd5a28

6 files changed

Lines changed: 535 additions & 411 deletions

File tree

.github/dependabot.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
schedule:
6+
interval: "weekly"

.github/workflows/ci.yml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
name: CI
2+
3+
on: [push, pull_request, workflow_dispatch]
4+
5+
jobs:
6+
build:
7+
name: "Build"
8+
runs-on: ${{ matrix.os }}
9+
strategy:
10+
fail-fast: false
11+
matrix:
12+
os: [ubuntu-24.04]
13+
include:
14+
- os: ubuntu-24.04
15+
steps:
16+
- uses: actions/checkout@v6
17+
- name: Build sourcemod plugin
18+
uses: maxime1907/action-sourceknight@v1
19+
with:
20+
cmd: build
21+
22+
- name: Create package
23+
run: |
24+
mkdir -p /tmp/package
25+
cp -R .sourceknight/package/* /tmp/package
26+
27+
- name: Upload build archive for test runners
28+
uses: actions/upload-artifact@v7
29+
with:
30+
name: ${{ runner.os }}
31+
path: /tmp/package
32+
33+
tag:
34+
name: Tag
35+
needs: build
36+
runs-on: ubuntu-latest
37+
steps:
38+
- uses: actions/checkout@v6
39+
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main'
40+
41+
- uses: dev-drprasad/delete-tag-and-release@v1.1
42+
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main'
43+
with:
44+
delete_release: true
45+
tag_name: latest
46+
env:
47+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48+
49+
- uses: rickstaa/action-create-tag@v1
50+
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main'
51+
with:
52+
tag: "latest"
53+
github_token: ${{ secrets.GITHUB_TOKEN }}
54+
55+
release:
56+
name: Release
57+
if: startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main'
58+
needs: [build, tag]
59+
runs-on: ubuntu-latest
60+
steps:
61+
- name: Download artifacts
62+
uses: actions/download-artifact@v8
63+
with:
64+
name: ${{ runner.os }}
65+
path: artifacts
66+
67+
- name: Versioning
68+
run: |
69+
version="latest"
70+
if [[ "${{ github.ref_type }}" == 'tag' ]]; then
71+
version=`echo $GITHUB_REF | sed "s/refs\/tags\///"`;
72+
fi
73+
echo "RELEASE_VERSION=$version" >> $GITHUB_ENV
74+
75+
- name: Package
76+
run: |
77+
cd artifacts
78+
ls -Rall
79+
tar -czf ../${{ github.event.repository.name }}-${{ env.RELEASE_VERSION }}.tar.gz .
80+
cd ..
81+
ls -la *.tar.gz
82+
83+
- name: Release
84+
uses: svenstaro/upload-release-action@v2
85+
with:
86+
repo_token: ${{ secrets.GITHUB_TOKEN }}
87+
file: '*.tar.gz'
88+
tag: ${{ env.RELEASE_VERSION }}
89+
file_glob: true
90+
overwrite: true

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
build/
2+
release/
3+
4+
.DS_Store
5+
.vscode
6+
7+
*.smx
8+
plugins/
9+
.sourceknight
10+
.venv

0 commit comments

Comments
 (0)