-
Notifications
You must be signed in to change notification settings - Fork 8
104 lines (93 loc) · 3.6 KB
/
assemble-distro.yml
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#
# This workflow is invoked when new changes are pushed to the `main` branch,
# or when new tags are created. It then assembles the package distribution
# tarballs, and uploads them to the given tag, or (in the case of pushes to
# `main`) to the tag `latest`; the `latest` tag then is also changed to point
# to the new HEAD of `main`.
#
# The purpose of this is that on the one hand, for a GAP releases such as
# 4.12.0, the corresponding package distribution is fixed and available from a
# matching tag, e.g. `v4.12.0`. On the other hand, for daily testing of GAP
# development versions and the package distribution, the `latest` tag can be
# used to get a snapshot of the package distribution as it is at the moment.
#
name: "Assemble the package distribution"
on:
workflow_dispatch: # manual trigger for debugging
push:
paths:
- 'packages/*/meta.json'
branches:
- main
tags:
- v[1-9]+.[0-9]+
- v[1-9]+.[0-9]+.[0-9]+*
# only run at most one instances of this workflow at a time for each branch
# resp. tag. Starting a new one cancels previously running ones.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
assemble:
name: "Assemble the package distribution"
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
# Cache the package archives we download across runs of this job
# to speed up things considerably
- name: "Cache archives"
uses: actions/cache@v4
with:
path: _archives
key: archives-${{ hashFiles('packages/*/meta.json') }}
restore-keys: |
archives-
- name: "Set up Python"
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: "Install package distribution tools"
run: python -m pip install -r tools/requirements.txt
- name: "Assemble distribution"
run: tools/assemble_distro.py
- name: "Cleanup archives"
run: tools/cleanup_archives.py
# Decide to which tag to update: if the trigger for this job was the
# creation of a tag `vX.Y.Z`, then upload to that tag.
# Otherwise upload to tag `latest` and move that tag to our commit
- name: "Determine target tag"
run: |
tag=latest
if [[ "$GITHUB_REF" = refs/tags/* ]] ; then
tag=${GITHUB_REF#"refs/tags/"}
fi
# Relevant documentation for the next line:
# https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#environment-files
echo "RELEASE_TAG=$tag" >> $GITHUB_ENV
- name: "Upload files to tag"
uses: softprops/action-gh-release@v1
if: ${{ github.event_name != 'workflow_dispatch' }}
with:
tag_name: ${{ env.RELEASE_TAG }}
target_commitish: ${{ github.sha }}
name: "GAP package distribution (${{ env.RELEASE_TAG }})"
body: |
Snapshot of the GAP package distribution
files: |
_releases/packages.tar.gz
_releases/packages.tar.gz.sha256
_releases/packages-required.tar.gz
_releases/packages-required.tar.gz.sha256
_releases/package-infos.json.gz
_releases/package-infos.json.gz.sha256
_releases/pkglist.csv
- name: "Update tag"
uses: actions/github-script@v7
with:
script: |
github.rest.git.updateRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: "tags/${{ env.RELEASE_TAG }}",
sha: context.sha
})