From 942e767c7e6b6579b5942b5b5c38be3f111985f5 Mon Sep 17 00:00:00 2001 From: Alexandr Bogomyakov Date: Mon, 4 May 2020 12:48:06 +0300 Subject: [PATCH] Update CI procedures. --- .github/workflows/PKGBUILD | 33 ++++++++++++++ .github/workflows/build.yml | 89 +++++++++++++++++++++++++++++++++++++ Cargo.toml | 2 +- 3 files changed, 123 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/PKGBUILD create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/PKGBUILD b/.github/workflows/PKGBUILD new file mode 100644 index 0000000..32c2af5 --- /dev/null +++ b/.github/workflows/PKGBUILD @@ -0,0 +1,33 @@ +# Maintainer: Alexandr Bogomyakov (ultradesu) + +pkgname=tmux-helper +pkgver=0.2.1 +pkgrel=1 +pkgdesc="Tmux helper" +url="https://github.com/house-of-vanity/tmux-helper.git" +arch=($CARCH) +license=(WTFPL custom) +depends=(tmux dbus) +makedepends=(cargo git dbus) +source=("git+https://github.com/house-of-vanity/$pkgname") +sha512sums=('SKIP') + +pkgver() { + cd "$srcdir/$pkgname" + git describe --long --tags | awk -F '-' '{print $1}'| sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g' +} + +prepare() { + cd "$srcdir/$pkgname" + cargo fetch --target $CARCH-unknown-linux-gnu +} + +build() { + cd "$srcdir/$pkgname" + cargo build --release --frozen --all-targets +} + +package() { + cd "$srcdir/$pkgname" + install -Dt "$pkgdir/usr/bin" target/release/$pkgname +} diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..8b8e7ee --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,89 @@ +name: Build and publish +on: + push: + # Sequence of patterns matched against refs/tags + tags: + - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 + +jobs: + make_bin: + name: Build binary + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Pre-build + run: sudo apt install -y libdbus-1-dev pkg-config libdbus-1-3 libfuse-dev + - uses: actions/checkout@v2 + - name: Build binary + run: cargo build --release + - name: Upload binary + uses: actions/upload-artifact@v1 + with: + name: tmux-helper + path: ./target/release/tmux-helper + make_arch: + name: Make Arch Linux package + runs-on: ubuntu-latest + container: + image: archlinux + options: --privileged + volumes: + - /sys/fs/cgroup:/sys/fs/cgroup + steps: + - uses: actions/checkout@v2 + - name: Build Arch Linux package + uses: FFY00/build-arch-package@master + with: + PKGBUILD: $GITHUB_WORKSPACE/.github/workflows/PKGBUILD + OUTDIR: $HOME/arch-packages + - run: mv $HOME/arch-packages/*pkg.tar.zst tmux-helper-x86_64.pkg.tar.zst + - name: Upload Arch Package + uses: actions/upload-artifact@v1 + with: + name: arch_linux_tmux-helper-x86_64.pkg.tar.zst + path: ./tmux-helper-x86_64.pkg.tar.zst + + publish: + name: Publish release + needs: [make_bin, make_arch] + runs-on: ubuntu-latest + steps: + - name: Get the version (git tag) + id: get_version + run: | + echo ${GITHUB_REF/refs\/tags\/v/} + echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\/v/} + echo ::set-output name=FULL_TAG::${GITHUB_REF/refs\/tags\//} + - 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: Download binary + uses: actions/download-artifact@v1 + with: + name: tmux-helper + path: ./artifacts/ + - name: Download Arch Package + uses: actions/download-artifact@v1 + with: + name: arch_linux_tmux-helper-x86_64.pkg.tar.zst + path: ./artifacts/ + - name: Download Deb Package + uses: actions/download-artifact@v1 + with: + name: tmux-helper_amd64.deb + path: ./artifacts/ + - name: Upload binary assets + run: | + wget https://github.com/aktau/github-release/releases/download/v0.7.2/linux-amd64-github-release.tar.bz2 + tar xjf linux-amd64-github-release.tar.bz2 + export GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} + ./bin/linux/amd64/github-release upload -u house-of-vanity -r tmux-helper --tag ${{ steps.get_version.outputs.FULL_TAG }} --name arch_linux_tmux-helper-${{ steps.get_version.outputs.VERSION }}-x86_64.pkg.tar.zst --file ./artifacts/tmux-helper-x86_64.pkg.tar.zst + ./bin/linux/amd64/github-release upload -u house-of-vanity -r tmux-helper --tag ${{ steps.get_version.outputs.FULL_TAG }} --name tmux-helper-${{ steps.get_version.outputs.VERSION }} --file ./artifacts/tmux-helper diff --git a/Cargo.toml b/Cargo.toml index ddf22c9..f29840a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tmux-helper" -version = "0.2.0" +version = "0.2.2" authors = ["Ultra Desu "] edition = "2018"