You've already forked ugly-queue
ci: Added Gitea Actions config 👷
This commit is contained in:
41
.github/workflows/build.yml
vendored
Normal file
41
.github/workflows/build.yml
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
name: CI
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- "**"
|
||||
tags:
|
||||
- " !**"
|
||||
|
||||
jobs:
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: '1.22'
|
||||
- name: Install gitea provider for Go Semantic Release
|
||||
run: |
|
||||
mkdir -p .semrel/$(go env GOOS)_$(go env GOARCH)/provider-gitea/${GITEA_PROVIDER_VER}/ && \
|
||||
wget https://github.com/cybercinch/go-semantic-release-provider-gitea/releases/download/v${GITEA_PROVIDER_VER}/go-semantic-release-provider-gitea_v${GITEA_PROVIDER_VER}_linux_amd64 \
|
||||
-O .semrel/$(go env GOOS)_$(go env GOARCH)/provider-gitea/${GITEA_PROVIDER_VER}/gitea && \
|
||||
chmod a+x .semrel/$(go env GOOS)_$(go env GOARCH)/provider-gitea/${GITEA_PROVIDER_VER}/gitea
|
||||
env:
|
||||
GITEA_PROVIDER_VER: 1.0.11
|
||||
- uses: "shivammathur/setup-php@v2"
|
||||
with:
|
||||
php-version: "7.4"
|
||||
- uses: "ramsey/composer-install@v3"
|
||||
|
||||
- name: Create Release Archive
|
||||
id: semrelease
|
||||
uses: go-semantic-release/action@v1
|
||||
with:
|
||||
# custom-arguments: --provider=gitea
|
||||
hooks: exec
|
||||
env:
|
||||
GITEA_TOKEN: ${{ secrets.G_TOKEN }}
|
||||
GITEA_HOST: ${{ secrets.G_SERVER_URL}}
|
||||
env:
|
||||
GITEA_TOKEN: ${{ secrets.G_TOKEN }}
|
||||
GITEA_HOST: ${{ secrets.G_SERVER_URL}}
|
||||
22
.semrelrc
Normal file
22
.semrelrc
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"plugins": {
|
||||
"provider": {
|
||||
"name": "gitea"
|
||||
},
|
||||
"changelog-generator": {
|
||||
"name": "default",
|
||||
"options": {
|
||||
"emojis": "true"
|
||||
}
|
||||
},
|
||||
"hooks": {
|
||||
"names": [
|
||||
"exec"
|
||||
],
|
||||
"options": {
|
||||
"exec_on_success": "./scripts/build.sh v{{.NewRelease.Version}}",
|
||||
"exec_on_no_release": "echo {{.Reason}}: {{.Message}}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
24
scripts/build.sh
Executable file
24
scripts/build.sh
Executable file
@@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
|
||||
mkdir -p ./build/tmp
|
||||
echo "Made temporary directory"
|
||||
|
||||
# Package up the release
|
||||
tar -czf "./build/ugly-queue-${1}.tar.gz" \
|
||||
--exclude='./vendor' \
|
||||
--exclude='./tests' \
|
||||
--exclude='./build' \
|
||||
.
|
||||
RELEASE_ID=$(curl --silent -X 'GET' "${GITEA_HOST}/api/v1/repos/cybercinch/ugly-queue/releases/latest" \
|
||||
-H "accept: application/json" \
|
||||
-H "Authorization: token ${GITEA_TOKEN}" | jq -r .id)
|
||||
|
||||
# Attach to release
|
||||
curl --silent -X 'POST' "${GITEA_HOST}/api/v1/repos/cybercinch/ugly-queue/releases/${RELEASE_ID}/assets?name=ugly-queue-${1}.tar.gz" \
|
||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||
--form attachment="@build/ugly-queue-${1}.tar.gz"
|
||||
|
||||
# Upload the artifact to composer registry
|
||||
curl -H "Authorization: token ${GITEA_TOKEN}" \
|
||||
--upload-file "build/ugly-queue-${1}.tar.gz" \
|
||||
"${GITEA_HOST}/api/packages/cybercinch/composer?version=${1}"
|
||||
22
tests/misc/cleanup.php
Normal file
22
tests/misc/cleanup.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
if (is_dir(__DIR__.'/queues/'))
|
||||
{
|
||||
foreach(glob(__DIR__.'/queues/*', GLOB_ONLYDIR) as $queueDir)
|
||||
{
|
||||
foreach(glob($queueDir.'/*') as $file)
|
||||
{
|
||||
$split = preg_split('#[/\\\]+#', $file);
|
||||
if (strpos(end($split), '.') === 0)
|
||||
continue;
|
||||
|
||||
unlink($file);
|
||||
}
|
||||
|
||||
rmdir($queueDir);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
mkdir(__DIR__.'/queues');
|
||||
}
|
||||
Reference in New Issue
Block a user