summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.forgejo/workflows/publish-release.yml25
-rw-r--r--documentation/release.md101
-rw-r--r--etc/tag-release.sh49
3 files changed, 175 insertions, 0 deletions
diff --git a/.forgejo/workflows/publish-release.yml b/.forgejo/workflows/publish-release.yml
new file mode 100644
index 0000000..5a7dcd6
--- /dev/null
+++ b/.forgejo/workflows/publish-release.yml
@@ -0,0 +1,25 @@
1on:
2 push:
3 tags: ['v*']
4
5jobs:
6 publish-release:
7 name: Publishes the `channels.scm` file for a Guix-Science release.
8 runs-on: guix
9 steps:
10 - run: |
11 set -e
12 set -x
13 set -o pipefail
14 TAG=$GITHUB_REF_NAME
15 # Clone full repository to get all tags (shallow cloning would skip some tags).
16 guix shell git-minimal nss-certs -CN -- git clone --tags $GITHUB_SERVER_URL/$GITHUB_REPOSITORY repo
17 cd repo
18 # Extract the 'channels.scm' contents from the tag's message (filtering out the header and the signature).
19 guix shell git-minimal -C -- git show $TAG --format=%N --no-patch | tail -n +4 | head -n -15 > channels.scm
20 # Create a release using the API, JSON data is stored in a file to prevent issues with mixing quotes
21 echo "{\"tag_name\": \"$TAG\", \"hide_archive_links\": true}" > json-data
22 RELEASE_ID=$(guix shell -CN curl nss-certs -- curl -H 'Content-Type: application/json' -d @json-data "$GITHUB_API_URL/repos/$GITHUB_REPOSITORY/releases?token=${{ secrets.TOKEN }}" | guix shell -C jq -- jq -r '.id')
23 # Add the channels file to the release
24 # TODO: verify request status.
25 guix shell -CN curl nss-certs -- curl -H 'accept: application/json' -H 'Content-Type: multipart/form-data' -F 'attachment=@channels.scm' --request POST "$GITHUB_API_URL/repos/$GITHUB_REPOSITORY/releases/$RELEASE_ID/assets?name=channels.scm&token=${{ secrets.TOKEN }}" \ No newline at end of file
diff --git a/documentation/release.md b/documentation/release.md
new file mode 100644
index 0000000..cad69c3
--- /dev/null
+++ b/documentation/release.md
@@ -0,0 +1,101 @@
1# Release process for the Guix-Science channel #
2
3## Introduction
4
5A "release of the Guix-Science channel" is a Guix-Science commit
6associated to a Guix revision against which the channel is guaranteed
7to build.
8
9A "release of the Guix-Science channel" is done by:
10 * tagging a specific commit of the repository, the tag name being
11 formatted as `vYYYYMMDD`, with a tag annotation described in the
12 next section,
13 * generating the corresponding `channels-YYYYMMD.scm` file with
14 pinned revisions for both the Guix and the Guix-Science channels,
15 using the commits above,
16 * providing the `channels-YYYYMMDD.scm` file in the Releases space
17 of the Codeberg repository.
18
19## Tag message format
20
21The tag message should embed the full `channels.scm` file content,
22which would include some metadata in the form of Scheme comments at
23the beginning of the message:
24 * first line should contain the Guix-Science release,
25 * second line should contain a blank line,
26 * third line should contain the Guix revision,
27 * the rest of the message should contain the corresponding list of
28 channels as a Guile object.
29
30Below is an example for the message that would be included in tag
31`v20260304` for a Guix-Science release at revision
32`8c2f79e97cff0003a0fcbab2e3bc4267d48c116c` against Guix revision
33`259643c993c6bba89a66da3b84329dd2e1dc439d`:
34
35```scheme
36;; Guix-Science release v20260304
37;;
38;; Guix revision: 259643c993c6bba89a66da3b84329dd2e1dc439d
39(list (channel
40 (name 'guix-science)
41 (url "https://codeberg.org/guix-science/guix-science.git")
42 (branch "master")
43 (commit
44 "8c2f79e97cff0003a0fcbab2e3bc4267d48c116c")
45 (introduction
46 (make-channel-introduction
47 "b1fe5aaff3ab48e798a4cce02f0212bc91f423dc"
48 (openpgp-fingerprint
49 "CA4F 8CF4 37D7 478F DA05 5FD4 4213 7701 1A37 8446"))))
50 (channel
51 (name 'guix)
52 (url "https://git.guix.gnu.org/guix.git")
53 (branch "master")
54 (commit
55 "259643c993c6bba89a66da3b84329dd2e1dc439d")
56 (introduction
57 (make-channel-introduction
58 "9edb3f66fd807b096b48283debdcddccfea34bad"
59 (openpgp-fingerprint
60 "BBB0 2DDF 2CEA F6A8 0D1D E643 A2A0 6DF2 A33A 54FA")))))
61
62```
63
64## Tagging a release
65
66A specific commit should be tagged using the script provided in the
67`./etc` directory at the root of the Guix-Science repository:
68
69```shell
70# Create the tag in the local checkout.
71sh ./etc/tag-release.sh vYYYYMMDD <guix-science-commit> <guix-revision>
72# Push the tag to the remote.
73git push --tags
74```
75
76After pushing the new tag to the remote repository, the Forgejo action
77defined in `publish-release.yml` will be executed, effectively
78creating a new entry in the Releases section of the Guix-Science
79repository, with the corresponding `channels.scm` file available for
80download.
81
82## Retrieving the Guix revision information manually from the tag
83
84In order to print the Guix revision information embedded with the tag,
85the following command can be issued:
86
87```shell
88git show vYYYYMMDD --format=%N --no-patch | awk '/;; Guix revision/ {print $4}'
89```
90
91## Retrieving the `channels.scm` information embedded in the tag
92
93The `channels.scm` file content corresponding to the `vYYYYMMDD` tag
94can be retrieved with the following command:
95
96```shell
97# This will print the information on screen. Redirect it to a file
98# by appending e.g. "> channels.scm" at the end of the command.
99git show vYYYYMMDD --format=%N --no-patch | tail -n +4 | head -n -15
100```
101
diff --git a/etc/tag-release.sh b/etc/tag-release.sh
new file mode 100644
index 0000000..d9b4a21
--- /dev/null
+++ b/etc/tag-release.sh
@@ -0,0 +1,49 @@
1#!/bin/sh
2
3set -e
4set -o pipefail
5
6TAG="$1"
7GUIX_SCIENCE_COMMIT="$2"
8GUIX_REVISION="$3"
9
10usage () {
11 echo "usage: $0 <release-tag> <guix-science-commit> <guix-revision>"
12 echo
13 echo "where <release-tag> is in the format vYYYYMMDD, <guix-science-commit>"
14 echo "is the Guix-Science commit to tag and <guix-revision> is the Guix"
15 echo "revision to associate with the release."
16}
17
18# TODO: check arguments.
19if [ $# -ne 3 ] ; then
20 usage
21 exit 1
22fi
23
24echo ";; Guix-Science release $TAG
25;;
26;; Guix revision: $GUIX_REVISION
27(list (channel
28 (name 'guix-science)
29 (url \"https://codeberg.org/guix-science/guix-science.git\")
30 (branch \"master\")
31 (commit
32 \"$GUIX_SCIENCE_COMMIT\")
33 (introduction
34 (make-channel-introduction
35 \"b1fe5aaff3ab48e798a4cce02f0212bc91f423dc\"
36 (openpgp-fingerprint
37 \"CA4F 8CF4 37D7 478F DA05 5FD4 4213 7701 1A37 8446\"))))
38 (channel
39 (name 'guix)
40 (url \"https://git.guix.gnu.org/guix.git\")
41 (branch \"master\")
42 (commit
43 \"$GUIX_REVISION\")
44 (introduction
45 (make-channel-introduction
46 \"9edb3f66fd807b096b48283debdcddccfea34bad\"
47 (openpgp-fingerprint
48 \"BBB0 2DDF 2CEA F6A8 0D1D E643 A2A0 6DF2 A33A 54FA\")))))
49" | git tag --annotate --sign -F - $TAG $GUIX_SCIENCE_COMMIT