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
21 changes: 5 additions & 16 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,9 @@ jobs:
date: ${{ needs.create-release.outputs.today }}
release_name: ${{ needs.create-release.outputs.release_name }}

release-forc-explorer:
release-forc-monorepo:
needs: create-release
uses: ./.github/workflows/nightly-forc-explorer-release.yml
secrets:
SLACK_WEBHOOK_TOOLING: ${{ secrets.SLACK_WEBHOOK_TOOLING }}
with:
date: ${{ needs.create-release.outputs.today }}
release_name: ${{ needs.create-release.outputs.release_name }}

release-forc-wallet:
needs: create-release
uses: ./.github/workflows/nightly-forc-wallet-release.yml
uses: ./.github/workflows/nightly-forc-monorepo-release.yml
secrets:
SLACK_WEBHOOK_TOOLING: ${{ secrets.SLACK_WEBHOOK_TOOLING }}
with:
Expand All @@ -95,20 +86,18 @@ jobs:
create-release,
release-forc,
release-fuel-core,
release-forc-explorer,
release-forc-wallet,
release-forc-monorepo,
]
runs-on: ubuntu-latest
if: always()

steps:
- name: Ensure release-forc succeeded
- name: Ensure all releases succeeded
run: |
if [ "${{ needs.create-release.result }}" != "success" ] || \
[ "${{ needs.release-forc.result }}" != "success" ] || \
[ "${{ needs.release-fuel-core.result }}" != "success" ] || \
[ "${{ needs.release-forc-explorer.result }}" != "success" ] || \
[ "${{ needs.release-forc-wallet.result }}" != "success" ]; then
[ "${{ needs.release-forc-monorepo.result }}" != "success" ]; then
echo "Workflow failed. Exiting..."
exit 1
else
Expand Down
169 changes: 0 additions & 169 deletions .github/workflows/nightly-forc-explorer-release.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Forc Wallet Release (nightly)
name: Forc Monorepo Release (nightly)

on:
workflow_dispatch:
Expand All @@ -17,19 +17,17 @@
env:
CARGO_TERM_COLOR: always
REGISTRY: ghcr.io
# Define workspace binaries here - everything else is derived from this list
BINARIES: "forc-wallet forc-crypto"

jobs:
prepare-release:
runs-on: ubuntu-latest
name: Prepare release
outputs:
tag: ${{ steps.set-tag.outputs.tag }}
zip_name: ${{ steps.set-name.outputs.zip_name }}
commit_hash: ${{ steps.set-commit-hash.outputs.commit_hash }}
versions_json: ${{ steps.set-versions.outputs.versions_json }}
steps:
# NOTE: As of v0.16.0, forc-wallet moved from FuelLabs/forc-wallet to the
# FuelLabs/forc monorepo. We now build from the monorepo and use the
# forc-wallet-X.Y.Z tag format instead of the legacy vX.Y.Z format.
- name: Checkout sources
uses: actions/checkout@v3
with:
Expand All @@ -39,134 +37,154 @@
- name: Set commit hash
id: set-commit-hash
run: |
echo "::set-output name=commit_hash::$(git rev-parse --short=10 HEAD)"
echo "commit_hash=$(git rev-parse --short=10 HEAD)" >> $GITHUB_OUTPUT

- name: Set tag
id: set-tag
- name: Set versions from tags
id: set-versions
run: |
# Find the latest forc-wallet-X.Y.Z tag reachable from HEAD
LATEST_TAG=$(git describe --tags --abbrev=0 --match 'forc-wallet-*')
# Extract version from tag (forc-wallet-X.Y.Z -> X.Y.Z)
VERSION="${LATEST_TAG#forc-wallet-}"
echo "::set-output name=tag::$VERSION"

- name: Set name
id: set-name
run: |
NAME=forc-wallet-${{ steps.set-tag.outputs.tag }}+nightly.${{ inputs.date }}.${{ steps.set-commit-hash.outputs.commit_hash }}
echo "::set-output name=zip_name::$NAME"
# Build a JSON object mapping binary name to version
VERSIONS_JSON="{"
FIRST=true
for BINARY in ${{ env.BINARIES }}; do
TAG=$(git describe --tags --abbrev=0 --match "${BINARY}-*")
VERSION="${TAG#${BINARY}-}"
echo "${BINARY} version: $VERSION"
if [ "$FIRST" = true ]; then
FIRST=false
else
VERSIONS_JSON+=","
fi
VERSIONS_JSON+="\"${BINARY}\":\"${VERSION}\""
done
VERSIONS_JSON+="}"
echo "versions_json=$VERSIONS_JSON" >> $GITHUB_OUTPUT

build-release:
name: Release forc-wallet binaries
name: Release forc monorepo binaries
runs-on: ${{ matrix.job.os }}
needs: prepare-release
strategy:
matrix:
job:
- os: ubuntu-latest
platform: linux
target: x86_64-unknown-linux-gnu
- os: ubuntu-latest
platform: linux
target: aarch64-unknown-linux-gnu
- os: macos-latest
platform: darwin
target: x86_64-apple-darwin
- os: macos-latest
platform: darwin
target: aarch64-apple-darwin
steps:
- name: Checkout sources
uses: actions/checkout@v3
with:
repository: FuelLabs/forc

- 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
key: '${{ matrix.job.target }}'

- name: Install cargo-edit
uses: actions-rs/cargo@v1
with:
command: install
args: cargo-edit --locked

- name: Bump patch version and add nightly pre-release tag
uses: actions-rs/cargo@v1
with:
command: set-version
args: --package forc-wallet --metadata nightly.${{ inputs.date }}.${{ needs.prepare-release.outputs.commit_hash }}
- name: Bump versions and add nightly pre-release tags
run: |
for BINARY in ${{ env.BINARIES }}; do
cargo set-version --package "$BINARY" --metadata nightly.${{ inputs.date }}.${{ needs.prepare-release.outputs.commit_hash }}
done

- name: Install cross
uses: baptiste0928/cargo-install@v1
with:
crate: cross
cache-key: '${{ matrix.job.target }}'

- name: Build forc-wallet
- name: Build forc monorepo binaries
run: |
cross build --profile=release --target ${{ matrix.job.target }} -p forc-wallet
PACKAGES=""
for BINARY in ${{ env.BINARIES }}; do
PACKAGES+=" -p $BINARY"
done
cross build --profile=release --target ${{ matrix.job.target }} $PACKAGES

- name: Strip release binary x86_64-linux-gnu
if: matrix.job.target == 'x86_64-unknown-linux-gnu'
run: |
strip "target/${{ matrix.job.target }}/release/forc-wallet"
for BINARY in ${{ env.BINARIES }}; do
strip "target/${{ matrix.job.target }}/release/$BINARY"
done

- name: Strip release binary aarch64-linux-gnu
if: matrix.job.target == 'aarch64-unknown-linux-gnu'
run: |
STRIP_ARGS=""
for BINARY in ${{ env.BINARIES }}; do
STRIP_ARGS+=" /target/aarch64-unknown-linux-gnu/release/$BINARY"
done
docker run --rm -v \
"$PWD/target:/target:Z" \
ghcr.io/cross-rs/aarch64-unknown-linux-gnu:main \
aarch64-linux-gnu-strip \
/target/aarch64-unknown-linux-gnu/release/forc-wallet
aarch64-linux-gnu-strip $STRIP_ARGS

- name: Strip release binary mac
if: matrix.job.os == 'macos-latest'
run: |
strip -x "target/${{ matrix.job.target }}/release/forc-wallet"
for BINARY in ${{ env.BINARIES }}; do
strip -x "target/${{ matrix.job.target }}/release/$BINARY"
done

- name: Prep Assets
id: prep_assets
- name: Prep and upload assets
env:
GITHUB_TOKEN: ${{ github.token }}
VERSIONS_JSON: ${{ needs.prepare-release.outputs.versions_json }}
run: |
ARTIFACT="${{ needs.prepare-release.outputs.zip_name }}-${{ matrix.job.target }}"
ZIP_FILE_NAME="$ARTIFACT.tar.gz"
echo "ZIP_FILE_NAME=$ZIP_FILE_NAME" >> $GITHUB_ENV
# create zip file
mkdir -pv "$ARTIFACT"

cp "target/${{ matrix.job.target }}/release/forc-wallet" "$ARTIFACT"

tar -czvf $ZIP_FILE_NAME "$ARTIFACT"

- name: Upload release archive
# Build newline-separated list for softprops/action-gh-release
echo 'ALL_ARCHIVES<<EOF' >> $GITHUB_ENV
for BINARY in ${{ env.BINARIES }}; do
VERSION=$(echo "$VERSIONS_JSON" | jq -r ".\"$BINARY\"")
ARTIFACT="${BINARY}-${VERSION}+nightly.${{ inputs.date }}.${{ needs.prepare-release.outputs.commit_hash }}-${{ matrix.job.target }}"
ZIP_FILE_NAME="$ARTIFACT.tar.gz"
mkdir -pv "$ARTIFACT"
cp "target/${{ matrix.job.target }}/release/$BINARY" "$ARTIFACT"
tar -czvf "$ZIP_FILE_NAME" "$ARTIFACT"
echo "$ZIP_FILE_NAME" >> $GITHUB_ENV
done
echo 'EOF' >> $GITHUB_ENV

- name: Upload release archives
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/master'
env:
GITHUB_TOKEN: ${{ github.token }}
with:
files:
${{ env.ZIP_FILE_NAME }}
files: ${{ env.ALL_ARCHIVES }}
Comment thread
JoshuaBatty marked this conversation as resolved.
tag_name: ${{ inputs.release_name }}

- name: Notify if matrix leg failed
if: always() && failure()
uses: ravsamhq/notify-slack-action@v1
with:
status: failure
token: ${{ secrets.GITHUB_TOKEN }}
notification_title: '{workflow} matrix leg failed'
message_format: '{emoji} *{workflow}* failed for target `${{ matrix.job.target }}` in <{repo_url}|{repo}> : <{run_url}|View Run Results>'
footer: ''
notify_when: 'failure'
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_TOOLING }}

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
Loading