GNOME Shell Extensions & CI: Part II

In the second part of the series, I will show how I publish releases using GitHub Actions.

If you haven’t read the first one yet, I would suggest doing this before. Here are links to the other parts:

  1. Bundling the Extension
  2. Automated Release Publishing (this post)
  3. Automated Tests with GitHub Actions

Publishing a Release on every Tag

All you need to do, is saving the following YAML code as .github/workflows/deploy.yml in your extension’s repository (the file name does not really matter as long it resides in the .github/workflows directory).

The action will be executed on every pushed tag. It will run on an Ubuntu container, checkout your repository, install some dependencies, execute make zip (from the previous part), and finally upload the resulting zip file to a new release on GitHub. The “Install Dependencies” step is only necessary if your extension requires gettext in order to be built. If your extension is not yet translated to other languages, you can delete this step.

The only thing which you will need to adapt is the zip file name in line 26, everything else is very generic.

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
name: Deploy

on:
  push:
    tags:
      - '**'

jobs:
  extension_bundle:
    name: Extension Bundle
    runs-on: ubuntu-latest
    steps:
    - name: Checkout Repository
      uses: actions/checkout@v2
    - name: Install Dependencies
      run: |
        sudo apt-get update -q
        sudo apt-get install gettext
    - name: Create Release
      run: |
        make zip
    - name: Upload Release
      uses: svenstaro/upload-release-action@2.2.1
      with:
        repo_token: ${{ secrets.GITHUB_TOKEN }}
        file: my-cool-extension@smy-cool-domain.com.zip
        tag: ${{ github.ref }}

That’s basically everything. If you now create a tag (let’s say v1) and push it to GitHub, the action will be executed and your bundled extension will be uploaded to a new release!

git tag v1
git push origin v1

You can then give the release a proper title and description. Finally, you can download the bundled extension and upload it to extensions.gnome.org.

Up Next: Automated Tests

In the last part of this series, I will show how I use GitHub Actions together with podman to automatically perform various tests on my GNOME Shell extensions.

Comments

blog comments powered by Disqus