Skip to content

[smallantimagmas] Update to 0.3.0 (#1070) #747

[smallantimagmas] Update to 0.3.0 (#1070)

[smallantimagmas] Update to 0.3.0 (#1070) #747

#
# 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
})