-
Notifications
You must be signed in to change notification settings - Fork 3
48 lines (46 loc) · 1.62 KB
/
release.yml
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
name: Publish Release
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+*'
jobs:
publish:
name: Build and publish
runs-on: ubuntu-18.04
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Check version
# Cargo requires that Cargo.toml contain a version, and that version is
# used by cargo-deb to build the package. Make sure that the version has
# been incremented to match the new tag.
run: |
gh_tag=$(echo "${{ github.ref }}")
version=${gh_tag#refs/tags/v}
echo "Working with version $version"
grep -q "version = \"$version\"" Cargo.toml || { echo "Version mismatch"; exit 1; }
echo "DEB_PKG_NAME=ptools_${version}_amd64.deb" >> $GITHUB_ENV
- name: Install cargo-deb
run: cargo install cargo-deb --version 1.27.0
- name: Build package
run: cargo deb
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Upload debian package
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./target/debian/${{ env.DEB_PKG_NAME }}
asset_name: ${{ env.DEB_PKG_NAME }}
asset_content_type: application/vnd.debian.binary-package