blob: 5a7dcd60911721aa4459642c8dc938983b6c34e6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
on:
push:
tags: ['v*']
jobs:
publish-release:
name: Publishes the `channels.scm` file for a Guix-Science release.
runs-on: guix
steps:
- run: |
set -e
set -x
set -o pipefail
TAG=$GITHUB_REF_NAME
# Clone full repository to get all tags (shallow cloning would skip some tags).
guix shell git-minimal nss-certs -CN -- git clone --tags $GITHUB_SERVER_URL/$GITHUB_REPOSITORY repo
cd repo
# Extract the 'channels.scm' contents from the tag's message (filtering out the header and the signature).
guix shell git-minimal -C -- git show $TAG --format=%N --no-patch | tail -n +4 | head -n -15 > channels.scm
# Create a release using the API, JSON data is stored in a file to prevent issues with mixing quotes
echo "{\"tag_name\": \"$TAG\", \"hide_archive_links\": true}" > json-data
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')
# Add the channels file to the release
# TODO: verify request status.
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 }}"
|