-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
139 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*' | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
jobs: | ||
all: | ||
name: All | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
target: | ||
- x86_64-apple-darwin | ||
- x86_64-pc-windows-msvc | ||
- x86_64-unknown-linux-gnu | ||
include: | ||
- target: x86_64-apple-darwin | ||
os: macos-latest | ||
target_rustflags: '' | ||
- target: x86_64-pc-windows-msvc | ||
os: windows-latest | ||
target_rustflags: '' | ||
- target: x86_64-unknown-linux-gnu | ||
os: ubuntu-latest | ||
target_rustflags: '' | ||
|
||
runs-on: ${{matrix.os}} | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Install Rust Toolchain Components | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
override: true | ||
target: ${{ matrix.target }} | ||
toolchain: stable | ||
|
||
- name: Install Linux Dependencies | ||
if: ${{ matrix.os == 'ubuntu-latest' }} | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install musl-tools libssl-dev pkg-config | ||
- name: Release Type | ||
id: release-type | ||
run: | | ||
if [[ ${{ github.ref }} =~ ^refs/tags/[0-9]+[.][0-9]+[.][0-9]+$ ]]; then | ||
echo ::set-output name=value::release | ||
else | ||
echo ::set-output name=value::prerelease | ||
fi | ||
- name: Package | ||
id: package | ||
env: | ||
TARGET: ${{ matrix.target }} | ||
REF: ${{ github.ref }} | ||
OS: ${{ matrix.os }} | ||
TARGET_RUSTFLAGS: ${{ matrix.target_rustflags }} | ||
run: ./bin/package | ||
shell: bash | ||
|
||
- name: Publish Archive | ||
uses: softprops/[email protected] | ||
if: ${{ startsWith(github.ref, 'refs/tags/') }} | ||
with: | ||
draft: false | ||
files: ${{ steps.package.outputs.archive }} | ||
prerelease: ${{ steps.release-type.outputs.value == 'prerelease' }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euxo pipefail | ||
|
||
VERSION=${REF#"refs/tags/"} | ||
DIST=`pwd`/dist | ||
|
||
echo "Packaging ord $VERSION for $TARGET..." | ||
|
||
test -f Cargo.lock || cargo generate-lockfile | ||
|
||
echo "Building ord..." | ||
RUSTFLAGS="--deny warnings $TARGET_RUSTFLAGS" \ | ||
cargo build --bin ord --target $TARGET --release | ||
EXECUTABLE=target/$TARGET/release/ord | ||
|
||
if [[ $OS == windows-latest ]]; then | ||
EXECUTABLE=$EXECUTABLE.exe | ||
fi | ||
|
||
echo "Copying release files..." | ||
mkdir dist | ||
cp \ | ||
$EXECUTABLE \ | ||
Cargo.lock \ | ||
Cargo.toml \ | ||
LICENSE \ | ||
README.md \ | ||
$DIST | ||
|
||
cd $DIST | ||
echo "Creating release archive..." | ||
case $OS in | ||
ubuntu-latest | macos-latest) | ||
ARCHIVE=$DIST/ord-$VERSION-$TARGET.tar.gz | ||
tar czf $ARCHIVE * | ||
echo "::set-output name=archive::$ARCHIVE" | ||
;; | ||
windows-latest) | ||
ARCHIVE=$DIST/ord-$VERSION-$TARGET.zip | ||
7z a $ARCHIVE * | ||
echo "::set-output name=archive::`pwd -W`/ord-$VERSION-$TARGET.zip" | ||
;; | ||
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,3 +45,17 @@ generate-paper-wallets: | |
print-paper-wallet path: | ||
wkhtmltopdf -L 25mm -R 25mm -T 50mm -B 25mm {{path}} wallet.pdf | ||
lp -o sides=two-sided-long-edge wallet.pdf | ||
|
||
# publish current GitHub master branch | ||
publish: | ||
#!/usr/bin/env bash | ||
set -euxo pipefail | ||
rm -rf tmp/release | ||
git clone [email protected]:casey/ord.git tmp/release | ||
VERSION=`sed -En 's/version[[:space:]]*=[[:space:]]*"([^"]+)"/\1/p' Cargo.toml | head -1` | ||
cd tmp/release | ||
git tag -a $VERSION -m "Release $VERSION" | ||
git push origin $VERSION | ||
cargo publish | ||
cd ../.. | ||
rm -rf tmp/release |