Skip to content
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
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
name: Lint
on: pull_request

jobs:
Expand Down
87 changes: 87 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: Release
on:
push:
tags:
- "v*"
pull_request:

jobs:
build:
name: Build release artifacts
strategy:
matrix:
include:
- os: ubuntu-22.04
relname: x86_64-linux
# uncomment when open-sourced
# - os: ubuntu-22.04-arm
# relname: arm64-linux
- os: macos-latest
relname: arm64-darwin
- os: macos-15-intel
relname: x86_64-darwin
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock', 'rust-toolchain.toml') }}-1
- name: Setup environment variables
run: |
echo "RUSTFLAGS=--remap-path-prefix=${GITHUB_WORKSPACE}=/builds/dfinity" >> $GITHUB_ENV
ver="v$(cargo metadata --format-version=1 --no-deps | jq -r '.packages[] | select(.name=="icp-cli-network-launcher") | .version')"
echo "VER=$ver" >> "$GITHUB_ENV"
- name: Verify version tag
if: ${{ github.ref_type == 'tag' }}
run: |
if [ "${GITHUB_REF_NAME}" != "${VER}" ]; then
echo "Tag ${GITHUB_REF_NAME} does not match package version ${VER}"
exit 1
fi
- name: Build and package
run: ./package.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload artifacts
uses: actions/upload-artifact@v4
if: ${{ github.ref_type == 'tag' }}
with:
name: icp-cli-network-launcher-${{ matrix.relname }}-${{ env.VER }}
path: dist/icp-cli-network-launcher-${{ matrix.relname }}-${{ env.VER }}.tar.gz

aggregate:
name: build:required
runs-on: ubuntu-latest
needs: build
if: ${{ always() }}
steps:
- if: ${{ needs.build.result != 'success' }}
run: exit 1

release:
name: Create release
if: ${{ github.ref_type == 'tag' }}
needs: build
runs-on: ubuntu-latest
strategy:
matrix:
# relname: [x86_64-linux, arm64-linux, arm64-darwin, x86_64-darwin]
relname: [x86_64-linux, arm64-darwin, x86_64-darwin]
steps:
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: icp-cli-network-launcher-${{ matrix.relname }}-${{ github.ref_name }}
- name: Upload tarball and sha256
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: icp-*.tar.*
file_glob: true
tag: ${{ github.ref_name }}
prerelease: true
make_latest: false
4 changes: 2 additions & 2 deletions package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ if [[ "$v" = *"+"* ]]; then
else
[[ "$source" != "git+"* ]] || die "package.version is not patch but pocket-ic dependency is git"
fi
name="icp-cli-network-launcher-${arch}-${os}-${v}"
name="icp-cli-network-launcher-${arch}-${os}-v${v}"
outdir="${1-"dist/${name}"}"

cargo build --release
mkdir -p "${outdir}"
cp "target/release/icp-cli-network-launcher" "${outdir}/"
if [[ -z "$sha" ]]; then
curl --proto '=https' -sSfL --tlsv1.2 "https://github.com/dfinity/pocketic/releases/download/${v}/pocket-ic-${arch}-${os}.gz" -o "${outdir}/pocket-ic.gz"
curl --proto '=https' -sSfL --tlsv1.2 "https://github.com/dfinity/pocketic/releases/download/${v}/pocket-ic-${arch}-${os}.gz" -o "${outdir}/pocket-ic.gz" ${GITHUB_TOKEN:+ -H "Authorization: Bearer ${GITHUB_TOKEN}" }
else
curl --proto '=https' -sSfL --tlsv1.2 "https://download.dfinity.systems/ic/${sha}/binaries/${arch}-${os}/pocket-ic.gz" -o "${outdir}/pocket-ic.gz"
fi
Expand Down