Automatic release with GitLab and SimpleRepos

Apr 27, 2019 by Thibault Debatty | 3191 views


SimpleRepos is a simple file sharing website that allows to upload files using a REST API. Here is how to use it in conjunction with GitLab to automatically release your binaries...


You will need a running web server (like one from DigitalOcean for example) and a GitLab project with a working Continus Integration (.gitlab-ci.yml).

Installation of SimpleRepos

On your webserver, download the latest release of SimpleRepos from


Extract the archive

unzip simple-repos-*.zip

Copy the example env file and modify it to fit your needs. Don't forget to modify the upload key!

cp .env
nano .env

Install composer dependencies:

composer install

Configure the database:

php artisan migrate

You're done!

Uploading files to SimpleRepos

SimpleRepos has a very simple REST API that allows to upload files. You can test it simply using curl on the command line:

export MY_TOKEN="upload_token_from_env_file"
curl ""  --request POST \
  --header "Authorization: Bearer $MY_TOKEN" -F 'file=@./'

Integration with GitLab

You can now use GitLab CI to automatically upload your releases to your SimpleRepos server.

Here is an example snippet for your .gitlab-ci.yml:

  - test
  - build
  - release

  stage: release
  # This runs only when we push new tags
    - tags
  image: debian:stretch-slim
    - apt-get update -yqq
    - apt-get install -yqq zip
    ## We first create a zip for this release
    - zip $ZIP_FILE -r MY_PROJECT
    - "curl$ZIP_FILE  \
        --request POST --header "Authorization: Bearer $UPLOAD_TOKEN" \
        -F "file=@./$ZIP_FILE""

It would not be safe to write your upload token ($UPLOAD_TOKEN in the example above) directly in your git repository, hence you now have to define an environment variable in GitLab:

  1. open your project's page in GitLab
  2. go to Settings > CI / CD
  3. click on 'Expand' next to 'Environment variables'
  4. define a variable called UPLOAD_TOKEN, with the value you defined in your env file

GitLab environment variables


Now you can create and upload a release simply by creating a tag and pushing it to your GitLab repository:

git tag 0.0.1
git push --tags

This will automatically trigger the release script, that will build the zip and upload it to SimpleRepos...

This website uses cookies. More information about the use of cookies is available in the cookies policy.