Skip to content

Fixed unnecessary tournament restart #149

Fixed unnecessary tournament restart

Fixed unnecessary tournament restart #149

Workflow file for this run

name: CI
on:
push:
branches:
- master
paths:
- "**/*.sp"
- "**/*.inc"
- "**/update.txt"
- "**/compile.yml"
- "prepare-publish.ps1"
pull_request:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup SourcePawn Compiler
uses: rumblefrog/setup-sp@v1.2.4
with:
version: "1.12.x"
- name: Prepare publish
run: |
pwsh prepare-publish.ps1
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
# Artifact name
name: ftp-files
# Directory containing files to upload
path: dist/ftp/
publish:
if: github.ref == 'refs/heads/master' && github.event_name != 'pull_request' && github.repository == 'F2/F2s-sourcemod-plugins'
needs: build
runs-on: ubuntu-latest
steps:
- name: Download files
uses: actions/download-artifact@v4
with:
# Artifact name
name: ftp-files
# Destination path
path: ftp/
- name: Set up node
uses: actions/setup-node@v2
with:
node-version: 16
- name: Install npm packages
run: npm install fs path
- name: Create release
uses: actions/github-script@v6
with:
script: |
const fs = require('fs');
const path = require('path');
const baseDir = "ftp";
const data = fs.readFileSync(path.join(baseDir, "f2-sourcemod-plugins.zip"));
const d = new Date();
const dateString =
d.getUTCFullYear() +
("0" + (d.getUTCMonth()+1)).slice(-2) +
("0" + d.getUTCDate()).slice(-2);
const entries = fs.readdirSync(baseDir, { withFileTypes: true });
let body = '| plugin | version |\n';
body += '| -- | -- |\n';
for (const entry of entries.filter((entry) => entry.isDirectory())) {
const p = path.join(baseDir, entry.name, "update.txt");
if (fs.existsSync(p)) {
const updateContents = fs.readFileSync(p);
const updateVersion = /"Latest"[ \t]+"([^"]+)"/.exec(updateContents);
if (updateVersion) {
body += `| ${entry.name} | ${updateVersion[1]} |\n`;
}
}
}
const release = await github.rest.repos.createRelease({
owner: "F2",
repo: "F2s-sourcemod-plugins",
tag_name: dateString + "-" + d.getTime(),
body: body,
});
github.rest.repos.uploadReleaseAsset({
owner: "F2",
repo: "F2s-sourcemod-plugins",
release_id: release.data.id,
name: "f2-sourcemod-plugins.zip",
data: data,
});
- name: Upload to FTP
working-directory: ftp
run: |
find . -type f -exec curl -u krus.dk:${{ secrets.FTP_KRUSDK_PASSWORD }} --ftp-create-dirs -T {} ftp://krus.dk/sourcemod/{} \;