mirror of
https://github.com/sayanarijit/xplr
synced 2024-11-18 09:26:05 +00:00
a1a1dee4af
Many crates are outdated. One is even yanked. IMO failing build is better than running with insecure/bad dependencies. Ref: https://github.com/sayanarijit/xplr/issues/212#issuecomment-855175144
119 lines
4.0 KiB
YAML
119 lines
4.0 KiB
YAML
name: Continuous Deployment
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- "v*.*.*"
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
publish:
|
|
name: Publishing for ${{ matrix.os }}
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
os:
|
|
- macos-latest
|
|
- ubuntu-latest
|
|
rust: [stable]
|
|
include:
|
|
- os: macos-latest
|
|
artifact_prefix: macos
|
|
target: x86_64-apple-darwin
|
|
binary_postfix: ""
|
|
- os: ubuntu-latest
|
|
artifact_prefix: linux
|
|
target: x86_64-unknown-linux-gnu
|
|
binary_postfix: ""
|
|
|
|
steps:
|
|
- name: Installing Rust toolchain
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: ${{ matrix.rust }}
|
|
override: true
|
|
- name: Installing needed macOS dependencies
|
|
if: matrix.os == 'macos-latest'
|
|
run: brew install openssl@1.1
|
|
- name: Installing needed Ubuntu dependencies
|
|
if: matrix.os == 'ubuntu-latest'
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y -qq pkg-config libssl-dev libxcb1-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev
|
|
- name: Checking out sources
|
|
uses: actions/checkout@v1
|
|
- name: Running cargo build
|
|
uses: actions-rs/cargo@v1
|
|
with:
|
|
command: build
|
|
toolchain: ${{ matrix.rust }}
|
|
args: --release --target ${{ matrix.target }}
|
|
|
|
- name: Install gpg secret key
|
|
run: |
|
|
cat <(echo -e "${{ secrets.GPG_SECRET }}") | gpg --batch --import
|
|
gpg --list-secret-keys --keyid-format LONG
|
|
|
|
- name: Packaging final binary
|
|
shell: bash
|
|
run: |
|
|
cd target/${{ matrix.target }}/release
|
|
BINARY_NAME=xplr${{ matrix.binary_postfix }}
|
|
strip $BINARY_NAME
|
|
RELEASE_NAME=xplr-${{ matrix.artifact_prefix }}
|
|
tar czvf $RELEASE_NAME.tar.gz $BINARY_NAME
|
|
shasum -a 256 $RELEASE_NAME.tar.gz > $RELEASE_NAME.sha256
|
|
cat <(echo "${{ secrets.GPG_PASS }}") | gpg --pinentry-mode loopback --passphrase-fd 0 --detach-sign --armor $RELEASE_NAME.tar.gz
|
|
|
|
- name: Releasing assets
|
|
uses: softprops/action-gh-release@v1
|
|
with:
|
|
files: |
|
|
target/${{ matrix.target }}/release/xplr-${{ matrix.artifact_prefix }}.tar.gz
|
|
target/${{ matrix.target }}/release/xplr-${{ matrix.artifact_prefix }}.sha256
|
|
target/${{ matrix.target }}/release/xplr-${{ matrix.artifact_prefix }}.tar.gz.asc
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
publish-gpg-signature:
|
|
name: Publishing GPG signature
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@master
|
|
- name: Install gpg secret key
|
|
run: |
|
|
cat <(echo -e "${{ secrets.GPG_SECRET }}") | gpg --batch --import
|
|
gpg --list-secret-keys --keyid-format LONG
|
|
|
|
- name: Signing archive with GPG
|
|
run: |
|
|
VERSION=${GITHUB_REF##*v}
|
|
git archive -o xplr-${VERSION:?}.tar.gz --format tar.gz --prefix "xplr-${VERSION:?}/" "v${VERSION}"
|
|
cat <(echo "${{ secrets.GPG_PASS }}") | gpg --pinentry-mode loopback --passphrase-fd 0 --detach-sign --armor "xplr-${VERSION:?}.tar.gz"
|
|
mv "xplr-${VERSION:?}.tar.gz.asc" "source.tar.gz.asc"
|
|
|
|
- name: Releasing GPG signature
|
|
uses: softprops/action-gh-release@v1
|
|
with:
|
|
files: |
|
|
source.tar.gz.asc
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
publish-cargo:
|
|
name: Publishing to Cargo
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@master
|
|
- uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: stable
|
|
override: true
|
|
- run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y -qq pkg-config libssl-dev libxcb1-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev
|
|
- uses: actions-rs/cargo@v1
|
|
with:
|
|
command: publish
|
|
args: --token ${{ secrets.CARGO_API_KEY }} --allow-dirty
|