2023-10-03 12:33:46 +00:00
|
|
|
# Generate a tarball, test it, then publish it to the package registry and create a release
|
2023-10-03 09:57:18 +00:00
|
|
|
|
|
|
|
variables:
|
|
|
|
PACKAGE_REGISTRY_URL: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/release-tarballs/${CI_COMMIT_TAG}"
|
|
|
|
RELEASE_TARBALL: "fractal-${CI_COMMIT_TAG}.tar.xz"
|
|
|
|
RELEASE_TARBALL_SHA: "fractal-${CI_COMMIT_TAG}.tar.xz.sha256sum"
|
2023-10-03 12:33:46 +00:00
|
|
|
METAINFO_PATH: "data/org.gnome.Fractal.metainfo.xml.in.in"
|
|
|
|
TARBALL_TEST_MANIFEST_PATH: ".gitlab-ci/org.gnome.Fractal.CiTest.json"
|
2023-10-03 09:57:18 +00:00
|
|
|
|
|
|
|
release-tarball:
|
2023-10-03 12:33:46 +00:00
|
|
|
stage: build
|
2023-10-03 09:57:18 +00:00
|
|
|
image: 'quay.io/gnome_infrastructure/gnome-runtime-images:gnome-master'
|
|
|
|
variables:
|
2023-10-03 12:33:46 +00:00
|
|
|
LANG: "C.UTF-8"
|
2023-10-03 09:57:18 +00:00
|
|
|
tags:
|
|
|
|
- flatpak
|
|
|
|
script:
|
2023-10-03 12:33:46 +00:00
|
|
|
# Create tarball with vendored rust dependencies
|
2023-10-03 09:57:18 +00:00
|
|
|
- flatpak-builder --keep-build-dirs --user --disable-rofiles-fuse --stop-at=${FLATPAK_MODULE} flatpak_app --repo=repo ${BRANCH:+--default-branch=$BRANCH} ${MANIFEST_PATH}
|
2023-11-24 20:46:36 +00:00
|
|
|
- echo "meson dist --no-test --allow-dirty" | flatpak-builder --disable-rofiles-fuse --build-shell=${FLATPAK_MODULE} flatpak_app ${MANIFEST_PATH}
|
2023-10-03 09:57:18 +00:00
|
|
|
- mv .flatpak-builder/build/${FLATPAK_MODULE}/_flatpak_build/meson-dist tarball
|
|
|
|
|
2023-10-03 12:33:46 +00:00
|
|
|
# Extract release notes of latest version from appstream
|
|
|
|
- appstreamcli metainfo-to-news --format markdown ${METAINFO_PATH} - |
|
|
|
|
awk '{ x[NR] = $0 } END { for ( i=5 ; i<=NR ; i++ ) { if (x[i] ~ /^$/ && x[i+1] ~ /^Version/ && x[i+2] ~ /^-/ && x[i+3] ~ /^Released:/) exit; else print x[i]; }}' >
|
|
|
|
release_notes.md
|
2023-10-03 09:57:18 +00:00
|
|
|
artifacts:
|
|
|
|
paths:
|
|
|
|
- tarball
|
2023-10-03 12:33:46 +00:00
|
|
|
- release_notes.md
|
|
|
|
|
|
|
|
test-tarball:
|
|
|
|
stage: test
|
|
|
|
image: 'quay.io/gnome_infrastructure/gnome-runtime-images:gnome-45'
|
|
|
|
tags:
|
|
|
|
- flatpak
|
|
|
|
script:
|
|
|
|
- TARBALL_SHA=$(cut -f 1 -d " " tarball/${RELEASE_TARBALL_SHA})
|
|
|
|
- sed -i "s|%%TARBALL_PATH%%|${PWD}/tarball/${RELEASE_TARBALL}|g" ${TARBALL_TEST_MANIFEST_PATH}
|
|
|
|
- sed -i "s|%%TARBALL_SHA%%|${TARBALL_SHA}|g" ${TARBALL_TEST_MANIFEST_PATH}
|
|
|
|
- flatpak-builder --user --disable-rofiles-fuse --sandbox flatpak_app --repo=repo ${BRANCH:+--default-branch=$BRANCH} ${TARBALL_TEST_MANIFEST_PATH}
|
2023-10-03 09:57:18 +00:00
|
|
|
|
|
|
|
# https://gitlab.com/gitlab-org/gitlab/-/issues/271534 The default URL needs authentication right now, which is less than optimal...
|
|
|
|
# Get the package_files ID instead and use that as download URL in the "release" step.
|
2023-10-03 12:33:46 +00:00
|
|
|
create-release:
|
2023-10-03 09:57:18 +00:00
|
|
|
stage: deploy
|
|
|
|
image: registry.gitlab.com/gitlab-org/release-cli:latest
|
|
|
|
script:
|
|
|
|
- apk add curl jq
|
2023-10-03 12:33:46 +00:00
|
|
|
|
|
|
|
# Upload tarball to package registry
|
|
|
|
- |
|
|
|
|
curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file tarball/${RELEASE_TARBALL} "${PACKAGE_REGISTRY_URL}/${RELEASE_TARBALL}"
|
|
|
|
- |
|
|
|
|
curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file tarball/${RELEASE_TARBALL_SHA} "${PACKAGE_REGISTRY_URL}/${RELEASE_TARBALL_SHA}"
|
|
|
|
|
|
|
|
# Get package IDs and build URLs
|
2023-10-03 09:57:18 +00:00
|
|
|
- |
|
|
|
|
export PACKAGE_ID=$(curl "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages?sort=desc" | jq -c .[0].id)
|
|
|
|
- |
|
|
|
|
export RELEASE_TARBALL_DOWNLOAD_ID=$(curl "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/${PACKAGE_ID}/package_files" | jq -c .[0].id)
|
|
|
|
export RELEASE_TARBALL_SHA_DOWNLOAD_ID=$(curl "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/${PACKAGE_ID}/package_files" | jq -c .[1].id)
|
|
|
|
- export RELEASE_TARBALL_URL="${CI_PROJECT_URL}/-/package_files/$RELEASE_TARBALL_DOWNLOAD_ID/download"
|
|
|
|
- export RELEASE_TARBALL_SHA_URL="${CI_PROJECT_URL}/-/package_files/$RELEASE_TARBALL_SHA_DOWNLOAD_ID/download"
|
2023-10-03 12:33:46 +00:00
|
|
|
- cat release_notes.md
|
|
|
|
|
|
|
|
# Create release
|
2023-10-03 09:57:18 +00:00
|
|
|
- |
|
2023-10-03 12:33:46 +00:00
|
|
|
release-cli create --name "$CI_COMMIT_TAG" --tag-name $CI_COMMIT_TAG \
|
2023-10-03 09:57:18 +00:00
|
|
|
--assets-link "{\"name\":\"Tarball for ${CI_COMMIT_TAG}\",\"url\":\"${RELEASE_TARBALL_URL}\", \"filepath\": \"/tarball/${RELEASE_TARBALL}\"}" \
|
|
|
|
--assets-link "{\"name\":\"Checksum for ${CI_COMMIT_TAG}\",\"url\":\"${RELEASE_TARBALL_SHA_URL}\", \"filepath\": \"/tarball/${RELEASE_TARBALL_SHA}\"}" \
|
2023-10-03 12:33:46 +00:00
|
|
|
--description release_notes.md
|