Clean up packaging

- Add optional support for CI/CD uploading to AWS S3 in addition to GCS.
- Package linux images as .tar.bz instead of .zip, and change layout
- Comment out unused stages in gridtracker.spec to quiet things.
merge-requests/31/head
Paul Traina 2020-11-20 15:23:04 -08:00
rodzic 9cb858ba62
commit 5855adf7c4
3 zmienionych plików z 44 dodań i 15 usunięć

Wyświetl plik

@ -5,15 +5,24 @@ variables:
DEFAULT_IMAGE: debian:stable
APT_CACHE_DIR: $CI_PROJECT_DIR/.cache/apt
NPM_CONFIG_CACHE: $CI_PROJECT_DIR/.cache/npm
#
# We have code in here for releasing on both GS and S3, control it through variables
# on GitLab, do not change it in this file.
#
GCLOUD_SERVICE_ACCOUNT: /dev/null
GCLOUD_RELEASE_DEPLOY_PATH: gs://download.gridtracker.org/release/$CI_COMMIT_TAG
GCLOUD_TESTING_DEPLOY_PATH: gs://download.gridtracker.org/testing/$CI_COMMIT_TAG
AWS_ACCESS_KEY_ID: ""
AWS_SECRET_ACCESS_KEY: ""
AWS_DEFAULT_REGION: ""
AWS_RELEASE_DEPLOY_PATH: s3://download.gridtracker.org/release/$CI_COMMIT_TAG
AWS_TESTING_DEPLOY_PATH: s3://download.gridtracker.org/testing/$CI_COMMIT_TAG
# nothing in this file should be allowed to run automatically except for:
# nothing in this file ill be allowed to run automatically except for:
# 1. merge requests
# 2. manual tagging
# 3. committing to the default branch
include:
- template: "Workflows/MergeRequest-Pipelines.gitlab-ci.yml"
@ -75,7 +84,8 @@ packaging:
- echo "Building native packages"
- npm install --prefer-offline
- npm run dist
- (cd dist ; mv *.zip *.exe *.7z *.json ../build)
- for dir in dist/*-linux-* ; do if [ -d $dir ] ; then tar -C dist -cjf ${dir}.tar.bz `basename $dir` ; fi ; done
- (cd dist ; mv *.exe *.mac-x64.zip *.tar.bz ../build)
- echo "Building Debian packages"
- dpkg-buildpackage -uc -us
- mv ../*.{deb,dsc,buildinfo,tar.xz,changes} build/debian/
@ -84,29 +94,43 @@ packaging:
- mv $HOME/rpmbuild/RPMS/noarch/gridtracker-*.noarch.rpm build/rpm
# copy the assets over to our distribution storage (testing, tag = test_.*)
upload_testing:
gs_upload_testing:
stage: deploy
image: google/cloud-sdk:alpine
needs:
- job: packaging
rules:
- if: '$CI_COMMIT_TAG =~ /^(test_).*/'
- if: '$CI_COMMIT_TAG =~ /^(test_).*/ && $GCLOUD_SERVICE_ACCOUNT != "/dev/null"'
script:
- gcloud auth activate-service-account --key-file $GCLOUD_SERVICE_ACCOUNT
- cd build; gsutil -m rsync -r . $GCLOUD_TESTING_DEPLOY_PATH
# copy the assets over to our distribution storage (full release, tag = v.*)
upload_release:
gs_upload_release:
stage: deploy
image: google/cloud-sdk:alpine
needs:
- job: packaging
rules:
- if: '$CI_COMMIT_TAG =~ /^(v).*/'
- if: '$CI_COMMIT_TAG =~ /^(v).*/ && $GCLOUD_SERVICE_ACCOUNT != "/dev/null"'
script:
- gcloud auth activate-service-account --key-file $GCLOUD_SERVICE_ACCOUNT
- cd build; gsutil -m rsync -r . $GCLOUD_RELEASE_DEPLOY_PATH
# copy the assets over to our distribution storage (testing, tag = test_.*)
s3_upload_testing:
stage: deploy
image: registry.gitlab.com/gitlab-org/cloud-deploy/aws-base:latest
rules:
- if: '$CI_COMMIT_TAG =~ /^(test_).*/ && $AWS_ACCESS_KEY_ID != ""'
script:
- cd build; aws s3 sync . $AWS_TESTING_DEPLOY_PATH
# copy the assets over to our distribution storage (full release, tag = v.*)
s3_upload_release:
stage: deploy
image: registry.gitlab.com/gitlab-org/cloud-deploy/aws-base:latest
rules:
- if: '$CI_COMMIT_TAG =~ /^(v).*/ && $AWS_ACCESS_KEY_ID != ""'
script:
- cd build; aws s3 sync . $AWS_RELEASE_DEPLOY_PATH
# this only creates a "source code release" -- gitlab doesn't specify binaries
# except as links to external storage, which is suboptimal for now
source_release:

Wyświetl plik

@ -7,6 +7,11 @@ mv ../*.{deb,dsc,buildinfo,changes,tar.xz} ../dist/debian
debian/rules clean
npm install
npm run dist
mv dist/*.{exe,7z,zip,json} ../dist
for dir in dist/*-linux-* ; do
if [ -d $dir ] ; then
tar -C dist -cjf ${dir}.tar.bz `basename $dir`
fi
done
mv dist/*{.exe,mac-x64.zip,.tar.bz} ../dist
rpmbuild -D "version `node ./version.js`" --build-in-place -bb gridtracker.spec
mv $HOME/rpmbuild/RPMS/noarch/gridtracker-*.noarch.rpm ../dist/rpm

Wyświetl plik

@ -31,11 +31,11 @@ make
%install
make install DESTDIR=${RPM_BUILD_ROOT}
%check
# %check
# desktop-file-validate desktop-file-validate %{buildroot}/%{_datadir}/applications/%{name}.desktop
%clean
make clean
# %clean
# make clean
%files
%{_bindir}/%{name}