Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nightly releases #459

Merged
merged 11 commits into from
Jan 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
138 changes: 78 additions & 60 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,86 +1,104 @@
name: Release version

on:
push:
tags:
- 'v*.*.*'
schedule:
- cron: '0 0 * * *'
onbjerg marked this conversation as resolved.
Show resolved Hide resolved
workflow_dispatch:
inputs:
tag:
description: 'Tag name to release or nightly for nightly releases'
required: true
default: nightly

env:
TAG_NAME: ${{ (github.event_name == 'schedule' && 'nightly') || github.inputs.tag || github.ref_name }}
IS_NIGHTLY: ${{ github.event_name != 'push' }}

jobs:
# this job builds the `forge` and `cast` binaries for the specified platforms
# in the matrix. The MacOS binaries do not support M1 yet: https://github.com/actions/runner/issues/805
build-artifacts:
runs-on: ${{ matrix.os }}
release:
name: ${{ matrix.job.target }} (${{ matrix.job.os }})
runs-on: ${{ matrix.job.os }}
strategy:
matrix:
os: [macos-latest, ubuntu-latest]
job:
# The OS is used for the runner
# The platform is a generic platform name
# The target is used by Cargo
# The arch is either 386 or amd64
- os: ubuntu-latest
platform: linux
target: x86_64-unknown-linux-gnu
arch: amd64
- os: macos-latest
platform: darwin
target: x86_64-apple-darwin
arch: amd64
# We can't compile for M1 yet
# See https://github.com/rust-bitcoin/rust-secp256k1/issues/283
#- os: macos-latest
# platform: darwin
# target: aarch64-apple-darwin
# arch: arm64
- os: windows-latest
platform: win32
target: x86_64-pc-windows-msvc
arch: amd64

steps:
- name: Checkout sources
uses: actions/checkout@v2

- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
target: ${{ matrix.job.target }}
override: true

- uses: Swatinem/rust-cache@v1
with:
cache-on-failure: true
- name: cargo build

- name: Build binaries
env:
RUSTFLAGS: -C link-args=-s
uses: actions-rs/cargo@v1
with:
command: build
args: --release

- name: Upload production artifacts
uses: actions/upload-artifact@v2
with:
name: target-${{ matrix.os }}
path: |
./target/release/forge
./target/release/cast
args: --release --bins --target ${{ matrix.job.target }}

# creates a GH release with the built binaries and CHANGELOG entry
create-release:
runs-on: ubuntu-latest
needs: build-artifacts
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 1000

- name: Set output
id: vars
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/}

- name: Restore artifacts
uses: actions/download-artifact@v2

- name: Build Changelog
id: github_release
uses: mikepenz/release-changelog-builder-action@v2.4.2
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}

- name: Create Release
id: create-release
uses: softprops/action-gh-release@v0.1.13
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
with:
tag_name: ${{ steps.vars.outputs.tag }}
release_name: ${{ github.ref }}
body: ${{steps.build_changelog.outputs.changelog}}
files: |
./target-macos-latest
./target-ubuntu-latest
- name: Archive binaries
id: artifacts
env:
PLATFORM_NAME: ${{ matrix.job.platform }}
ARCH: ${{ matrix.job.arch }}
run: |
if [ "$PLATFORM_NAME" != "win32" ]; then
tar -czvf "foundry_${TAG_NAME}_${PLATFORM_NAME}_${ARCH}.tar.gz" -C ./target/release forge cast
echo "::set-output name=file_name::foundry_${TAG_NAME}_${PLATFORM_NAME}_${ARCH}.tar.gz"
else
cd ./target/release
7z a -tzip "foundry_${TAG_NAME}_${PLATFORM_NAME}_${ARCH}.zip" forge.exe cast.exe
mv "foundry_${TAG_NAME}_${PLATFORM_NAME}_${ARCH}.zip" ../../
echo "::set-output name=file_name::foundry_${TAG_NAME}_${PLATFORM_NAME}_${ARCH}.zip"
fi
shell: bash

- name: Build changelog
id: build_changelog
if: ${{ env.IS_NIGHTLY == false }}
uses: mikepenz/release-changelog-builder-action@v2.4.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# after the GH release is done, proceed to open a PR on homebrew-core
publish-homebrew:
runs-on: ubuntu-latest
needs: build-artifacts
steps:
- name: Create homebrew-core PR
uses: mislav/bump-homebrew-formula-action@v1.12
- name: Create release
uses: softprops/action-gh-release@v1
with:
formula-name: foundry
env:
COMMITTER_TOKEN: ${{ secrets.GH_TOKEN }}
tag_name: ${{ env.TAG_NAME }}
draft: ${{ env.IS_NIGHTLY }}
body: ${{ steps.build_changelog.outputs.changelog }}
files: ${{ steps.artifacts.outputs.file_name }}
Comment on lines +101 to +104
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can add a token here to set the committer's identity, but that requires a personal access token. See here.

@gakonst let me know if that is something you want to do, then I'll add it (just tell me the name of the secret)

5 changes: 5 additions & 0 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,8 @@ doc = false
name = "forge"
path = "src/forge.rs"
doc = false

[profile.release]
lto = true
codegen-units = 1
panic = "abort"