1name: Build AppImage
2on:
3  push:
4    branches:
5      - main
6    tags:
7      - v*
8
9jobs:
10  build:
11    runs-on: ubuntu-20.04
12    steps:
13      - run: sudo apt-get -qq update
14      - name: Install dependencies
15        run: |
16          sudo apt-get install -yqq --no-install-recommends \
17            audacious-dev \
18            cmake \
19            docbook2x \
20            gawk \
21            lcov \
22            libaudclient-dev \
23            libcairo2-dev \
24            libcurl4-gnutls-dev \
25            libglib2.0-dev \
26            libical-dev \
27            libimlib2-dev \
28            libircclient-dev \
29            libiw-dev \
30            liblua5.3-dev \
31            libmicrohttpd-dev \
32            libmysqlclient-dev \
33            libpulse-dev \
34            librsvg2-dev \
35            libsystemd-dev \
36            libx11-dev \
37            libxdamage-dev \
38            libxext-dev \
39            libxft-dev \
40            libxinerama-dev \
41            libxml2-dev \
42            libxmmsclient-dev \
43            libxnvctrl-dev \
44            ncurses-dev
45      - name: Checkout
46        uses: actions/checkout@v2
47      - name: Import GPG Deploy Key
48        run: |
49          echo "${{ secrets.GPG_DEPLOY_KEY }}" > appimage/secret.gpg
50          gpg --import appimage/secret.gpg
51      - name: Build AppImage
52        run: ./appimage/build.sh
53      - name: Archive AppImage
54        uses: actions/upload-artifact@v2
55        with:
56          name: conky-appimage
57          path: conky*.AppImage
58      - name: Get Name of Artifact
59        run: |
60          ARTIFACT_PATHNAME=$(ls conky*.AppImage | head -n 1)
61          ARTIFACT_NAME=$(basename $ARTIFACT_PATHNAME)
62          echo "ARTIFACT_PATHNAME=${ARTIFACT_PATHNAME}" >> $GITHUB_ENV
63          echo "ARTIFACT_NAME=${ARTIFACT_NAME}" >> $GITHUB_ENV
64      - name: Print Name of Artifact
65        run: |
66          echo ARTIFACT_PATHNAME=${{ env.ARTIFACT_PATHNAME }}
67          echo ARTIFACT_NAME=${{ env.ARTIFACT_NAME }}
68      - name: Create Conky Release
69        id: create_release
70        uses: actions/create-release@v1
71        if: startsWith(github.ref, 'refs/tags/v')
72        env:
73          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
74        with:
75          tag_name: ${{ github.ref }}
76          release_name: Conky ${{ github.ref }}
77          draft: false
78          prerelease: false
79      - name: Upload Conky Release Asset
80        id: upload-release-asset
81        uses: actions/upload-release-asset@v1
82        if: startsWith(github.ref, 'refs/tags/v')
83        env:
84          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
85        with:
86          upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
87          asset_path: ${{ env.ARTIFACT_PATHNAME }}
88          asset_name: ${{ env.ARTIFACT_NAME }}
89          asset_content_type: application/x-executable
90