Skip to content

Commit 6aafcfa

Browse files
authored
Merge pull request #9 from grml/zeha/releases
Add GitHub README and workflows
2 parents b545b85 + 97701e9 commit 6aafcfa

File tree

7 files changed

+242
-37
lines changed

7 files changed

+242
-37
lines changed

.github/dependabot.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
version: 2
2+
updates:
3+
# Enable version updates for GitHub Actions
4+
- package-ecosystem: "github-actions"
5+
directory: "/"
6+
schedule:
7+
interval: "weekly"
8+
day: "monday"
9+
time: "08:00"
10+
open-pull-requests-limit: 5
11+
commit-message:
12+
prefix: "ci"
13+
include: "scope"
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: package-build
2+
on:
3+
pull_request:
4+
push:
5+
tags:
6+
- 'v*'
7+
permissions:
8+
actions: read
9+
contents: read
10+
pull-requests: write
11+
concurrency:
12+
group: "${{ github.ref }}"
13+
cancel-in-progress: true
14+
jobs:
15+
build-debian:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v5
19+
- name: "Update changelog"
20+
run: |
21+
set -ex
22+
OLD_VERSION=$(dpkg-parsechangelog -SVersion)
23+
SOURCE=$(dpkg-parsechangelog -SSource)
24+
if [[ "${{ github.ref_type }}" == "tag" ]]; then
25+
VERSION_SUFFIX="+gh"
26+
else
27+
VERSION_SUFFIX="+autobuild${GITHUB_RUN_NUMBER}"
28+
fi
29+
cat > debian/changelog <<EOT
30+
${SOURCE} (${OLD_VERSION}${VERSION_SUFFIX}) UNRELEASED; urgency=medium
31+
32+
* Automated Build
33+
34+
-- Automated Build <builder@localhost> $(date -R)
35+
EOT
36+
- uses: jtdor/build-deb-action@v1
37+
- name: Archive build result
38+
uses: actions/upload-artifact@v4
39+
with:
40+
name: packages
41+
if-no-files-found: error
42+
retention-days: 14
43+
path: |
44+
debian/artifacts/*.deb
45+
debian/artifacts/*.tar.*
46+
- name: Comment PR with artifact link
47+
if: github.event_name == 'pull_request'
48+
uses: actions/github-script@v8
49+
with:
50+
script: |
51+
const runId = context.runId;
52+
const repoOwner = context.repo.owner;
53+
const repoName = context.repo.repo;
54+
55+
// Get the artifact download URL
56+
const artifacts = await github.rest.actions.listWorkflowRunArtifacts({
57+
owner: repoOwner,
58+
repo: repoName,
59+
run_id: runId
60+
});
61+
62+
const packagesArtifact = artifacts.data.artifacts.find(artifact => artifact.name === 'packages');
63+
if (!packagesArtifact) {
64+
console.log('No packages artifact found');
65+
return;
66+
}
67+
68+
const artifactUrl = `https://github.com/${repoOwner}/${repoName}/actions/runs/${runId}/artifacts/${packagesArtifact.id}`;
69+
70+
github.rest.issues.createComment({
71+
issue_number: context.issue.number,
72+
owner: context.repo.owner,
73+
repo: context.repo.repo,
74+
body: `📦 Built packages are ready! [Download here](${artifactUrl}).`
75+
});

.github/workflows/release.yml

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
name: release
2+
on:
3+
push:
4+
tags:
5+
- 'v*'
6+
7+
jobs:
8+
create-release:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
actions: read
12+
contents: write
13+
steps:
14+
- uses: actions/checkout@v5
15+
16+
- name: Extract version from tag
17+
id: version
18+
run: |
19+
TAG_NAME="${GITHUB_REF#refs/tags/}"
20+
VERSION="${TAG_NAME#v}"
21+
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
22+
echo "tag=${TAG_NAME}" >> "$GITHUB_OUTPUT"
23+
24+
- name: Extract changelog entry
25+
id: changelog
26+
run: |
27+
VERSION="${{ steps.version.outputs.version }}"
28+
29+
# Extract and clean changelog for this specific version
30+
CHANGES=$(dpkg-parsechangelog -l debian/changelog --since "${VERSION}" --until "${VERSION}" --show-field Changes | \
31+
sed '/^[a-zA-Z0-9-].*([^)]*)[[:space:]]*.*$/d' | \
32+
sed 's/^[[:space:]]*\.[[:space:]]*$//' | \
33+
sed '/^[[:space:]]*$/d' | \
34+
sed 's/^[[:space:]]*\*[[:space:]]*/- /' | \
35+
sed 's/^[[:space:]]*\\+[[:space:]]*/ - /')
36+
37+
# Set as output for use in release
38+
{
39+
echo 'description<<EOF'
40+
echo "$CHANGES"
41+
echo 'EOF'
42+
} >> "$GITHUB_OUTPUT"
43+
44+
- name: Wait for and get package build run ID
45+
id: build-run
46+
uses: actions/github-script@v8
47+
with:
48+
script: |
49+
const maxWaitTime = 10 * 60 * 1000; // 10 minutes
50+
const pollInterval = 30 * 1000; // 30 seconds
51+
const startTime = Date.now();
52+
53+
while (Date.now() - startTime < maxWaitTime) {
54+
const runs = await github.rest.actions.listWorkflowRuns({
55+
owner: context.repo.owner,
56+
repo: context.repo.repo,
57+
workflow_id: 'package-build.yml',
58+
head_sha: context.sha,
59+
status: 'completed',
60+
conclusion: 'success'
61+
});
62+
63+
if (runs.data.workflow_runs.length > 0) {
64+
const runId = runs.data.workflow_runs[0].id;
65+
console.log(`Found successful package-build run: ${runId}`);
66+
return runId;
67+
}
68+
69+
console.log('Package-build workflow not completed yet, waiting...');
70+
await new Promise(resolve => setTimeout(resolve, pollInterval));
71+
}
72+
73+
throw new Error('Package-build workflow did not complete successfully within 10 minutes');
74+
75+
- name: Download build artifacts
76+
uses: actions/download-artifact@v5
77+
with:
78+
name: packages
79+
path: artifacts/
80+
run-id: ${{ steps.build-run.outputs.result }}
81+
github-token: ${{ secrets.GITHUB_TOKEN }}
82+
83+
- name: Create GitHub Release
84+
run: |
85+
DEB_FILE=$(find artifacts -name "*.deb" -printf "%f\n" | head -1)
86+
gh release create "${{ steps.version.outputs.tag }}" \
87+
--title "Release ${{ steps.version.outputs.tag }}" \
88+
--notes "## Changes in ${{ steps.version.outputs.version }}
89+
90+
${{ steps.changelog.outputs.description }}
91+
92+
---
93+
94+
📦 **Installation:**
95+
Download the package and install with:
96+
\`\`\`bash
97+
sudo apt install ./${DEB_FILE}
98+
\`\`\`" \
99+
artifacts/*
100+
env:
101+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/test-build.yml

Lines changed: 0 additions & 33 deletions
This file was deleted.

README.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# grml-paste
2+
3+
[![Sponsor](https://img.shields.io/badge/Sponsor-GitHub-purple?logo=github)](https://github.com/sponsors/grml)
4+
[![GitHub release](https://img.shields.io/github/v/release/grml/grml-paste)](https://github.com/grml/grml-paste/releases)
5+
[![Debian package](https://img.shields.io/debian/v/grml-paste/trixie?label=debian)](https://packages.debian.org/trixie/grml-paste)
6+
[![Ubuntu package](https://img.shields.io/ubuntu/v/grml-paste)](https://packages.ubuntu.com/search?keywords=grml-paste)
7+
8+
Paste text into a pastebin service
9+
10+
## Overview
11+
12+
grml-paste is a client for a pastebin service like https://paste.debian.net/.
13+
14+
## Installation
15+
16+
### From Debian repositories
17+
18+
```bash
19+
sudo apt install grml-paste
20+
```
21+
22+
Package information: [grml-paste on packages.debian.org](https://packages.debian.org/trixie/grml-paste)
23+
24+
### From GitHub releases
25+
26+
Download the latest `.deb` package from the [releases page](../../releases) and install:
27+
28+
```bash
29+
sudo apt install ./grml-paste_*.deb
30+
```
31+
32+
## Quick start
33+
34+
1. Install the package (see above)
35+
2. Paste some text:
36+
```bash
37+
echo hi | grml-paste
38+
```
39+
40+
## License
41+
42+
This project is licensed under the GPL v2+.
43+
44+
## Contributing
45+
46+
- **Source code**: https://github.com/grml/grml-paste
47+
- **Issues**: https://github.com/grml/grml-paste/issues
48+
- **Releases**: https://github.com/grml/grml-paste/releases
49+
- **Grml Live Linux**: https://grml.org

grml-paste

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/python3
22
# Filename: grml-paste
3-
# Purpose: XmlRpc interface client to paste.grml.org
3+
# Purpose: XmlRpc Pastebin interface client
44
# Author: Michael Gebetsroither <gebi@grml.org>
55
# License: This file is licensed under the GPL v2.
66
################################################################################

grml-paste.1.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ grml-paste(1)
33

44
Name
55
----
6-
grml-paste - command line interface for paste.grml.org
6+
grml-paste - command line interface for xmlrpc pastebins
77

88
Synopsis
99
--------
@@ -12,7 +12,7 @@ grml-paste [options] ACTION <args>
1212
Description
1313
-----------
1414

15-
grml-paste is a command line interface for uploading plain text to https://paste.grml.org/
15+
grml-paste is a command line interface for uploading plain text to https://paste.debian.net/
1616

1717
Options
1818
-------
@@ -35,7 +35,7 @@ Set your nickname (defaults to login username).
3535

3636
**-s 'server', --server='SERVER'**::
3737

38-
Set URL of paste server (defaults to paste.grml.org).
38+
Set URL of paste server (defaults to paste.debian.net).
3939

4040
**-p, --private**::
4141

0 commit comments

Comments
 (0)