From 9c4de6c520c746e19918e4e2d9dbeab0ef98735c Mon Sep 17 00:00:00 2001 From: Ben Johnson Date: Thu, 21 Jan 2021 14:34:42 -0700 Subject: [PATCH] Debian release action --- .github/workflows/release.yml | 21 ++++++++++++++++++--- Makefile | 4 ++-- README.md | 2 +- etc/nfpm.yml | 8 ++++---- 4 files changed, 25 insertions(+), 10 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7410d56..7e3502e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,7 +5,7 @@ on: name: release jobs: - release: + linux: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -18,8 +18,13 @@ jobs: - name: Build litestream run: | - go build -ldflags "-X 'main.Version=${{ steps.release.outputs.tag_name }}'" -o litestream ./cmd/litestream + mkdir -p dist + cp etc/litestream.yml etc/litestream.service dist + cat etc/nfpm.yml | LITESTREAM_VERSION=${{ steps.release.outputs.tag_name }} envsubst > dist/nfpm.yml + go build -ldflags "-X 'main.Version=${{ steps.release.outputs.tag_name }}'" -o dist/litestream ./cmd/litestream + cd dist tar -czvf litestream-${{ steps.release.outputs.tag_name }}-linux-amd64.tar.gz litestream + nfpm pkg --config nfpm.yml --packager deb --target litestream-${{ steps.release.outputs.tag_name }}-linux-amd64.deb - name: Upload release binary uses: actions/upload-release-asset@v1.0.2 @@ -27,6 +32,16 @@ jobs: GITHUB_TOKEN: ${{ github.token }} with: upload_url: ${{ steps.release.outputs.upload_url }} - asset_path: ./litestream-${{ steps.release.outputs.tag_name }}-linux-amd64.tar.gz + asset_path: ./dist/litestream-${{ steps.release.outputs.tag_name }}-linux-amd64.tar.gz asset_name: litestream-${{ steps.release.outputs.tag_name }}-linux-amd64.tar.gz asset_content_type: application/gzip + + - name: Upload debian package + uses: actions/upload-release-asset@v1.0.2 + env: + GITHUB_TOKEN: ${{ github.token }} + with: + upload_url: ${{ steps.release.outputs.upload_url }} + asset_path: ./dist/litestream-${{ steps.release.outputs.tag_name }}-linux-amd64.deb + asset_name: litestream-${{ steps.release.outputs.tag_name }}-linux-amd64.deb + asset_content_type: application/octet-stream diff --git a/Makefile b/Makefile index f28e223..1524d97 100644 --- a/Makefile +++ b/Makefile @@ -7,8 +7,8 @@ dist: tar -cz -f dist/litestream-linux-amd64.tar.gz -C dist litestream deb: dist -ifndef VERSION - $(error VERSION is undefined) +ifndef LITESTREAM_VERSION + $(error LITESTREAM_VERSION is undefined) endif cat etc/nfpm.yml | envsubst > dist/nfpm.yml nfpm pkg --config dist/nfpm.yml --packager deb --target dist/litestream.deb diff --git a/README.md b/README.md index 2ccedd4..a2ffbc6 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ You can download the `.deb` file from the [Releases page][releases] page and then run the following: ```sh -$ sudo dpkg -i litestream-v0.3.0.deb +$ sudo dpkg -i litestream-v0.3.0-linux-amd64.deb ``` Once installed, you'll need to enable & start the service: diff --git a/etc/nfpm.yml b/etc/nfpm.yml index 7aad52c..b86eef5 100644 --- a/etc/nfpm.yml +++ b/etc/nfpm.yml @@ -9,11 +9,11 @@ description: Litestream is a tool for real-time replication of SQLite databases. homepage: "https://github.com/benbjohnson/litestream" license: "GPLv3" contents: -- src: ./dist/litestream +- src: ./litestream dst: /usr/bin/litestream -- src: ./etc/litestream.yml +- src: ./litestream.yml dst: /etc/litestream.yml type: config -- src: ./etc/litestream.service +- src: ./litestream.service dst: /usr/lib/systemd/system/litestream.service - type: config \ No newline at end of file + type: config