Skip to content

Build Wallet App

Build Wallet App #3

name: Build Wallet App
on:
push:
tags:
- "wallet-v[0-9]+.[0-9]+.[0-9]+"
workflow_dispatch:
inputs:
deploy_type:
description: "Deploy type"
required: true
type: choice
options:
- rc
- production
rc_version:
description: "The RC numeric version (only used for RC builds)"
type: string
required: false
jobs:
resolve-deploy-type:
runs-on: ubuntu-latest
outputs:
deploy_type: ${{ steps.resolve.outputs.deploy_type }}
environment: ${{ steps.resolve.outputs.environment }}
apps_backend_secret: ${{ steps.resolve.outputs.apps_backend_secret }}
default_network_secret: ${{ steps.resolve.outputs.default_network_secret }}
iota_networks_secret: ${{ steps.resolve.outputs.iota_networks_secret }}
rc_version: ${{ steps.resolve.outputs.rc_version }}
steps:
- name: Resolve deploy type
id: resolve
run: |
if [ "${{ github.event_name }}" = "push" ]; then
DEPLOY_TYPE="production"
else
DEPLOY_TYPE="${{ inputs.deploy_type }}"
fi
case "$DEPLOY_TYPE" in
rc)
ENVIRONMENT="RC – wallet"
APPS_BACKEND_SECRET="RC_APPS_BACKEND"
DEFAULT_NETWORK_SECRET="WALLET_RC_DEFAULT_NETWORK"
IOTA_NETWORKS_SECRET="WALLET_RC_IOTA_NETWORKS"
RC_VERSION="${{ inputs.rc_version }}"
if [ -z "$RC_VERSION" ]; then
echo "::error::rc_version is required for RC builds"
exit 1
fi
;;
production)
ENVIRONMENT="Production – wallet"
APPS_BACKEND_SECRET="PROD_APPS_BACKEND"
DEFAULT_NETWORK_SECRET="WALLET_PROD_DEFAULT_NETWORK"
IOTA_NETWORKS_SECRET="WALLET_PROD_IOTA_NETWORKS"
RC_VERSION=""
;;
esac
echo "deploy_type=$DEPLOY_TYPE" >> "$GITHUB_OUTPUT"
echo "environment=$ENVIRONMENT" >> "$GITHUB_OUTPUT"
echo "apps_backend_secret=$APPS_BACKEND_SECRET" >> "$GITHUB_OUTPUT"
echo "default_network_secret=$DEFAULT_NETWORK_SECRET" >> "$GITHUB_OUTPUT"
echo "iota_networks_secret=$IOTA_NETWORKS_SECRET" >> "$GITHUB_OUTPUT"
echo "rc_version=$RC_VERSION" >> "$GITHUB_OUTPUT"
wallet-build:
needs: resolve-deploy-type
runs-on: [self-hosted-x64]
environment: ${{ needs.resolve-deploy-type.outputs.environment }}
permissions:
contents: write
env:
DEFAULT_NETWORK: ${{ secrets[needs.resolve-deploy-type.outputs.default_network_secret] }}
IOTA_NETWORKS: ${{ secrets[needs.resolve-deploy-type.outputs.iota_networks_secret] }}
APPS_BACKEND: ${{ secrets[needs.resolve-deploy-type.outputs.apps_backend_secret] }}
SENTRY_AUTH_TOKEN: ${{ secrets.TOOLING_SENTRY_AUTH_TOKEN }}
DEPLOY_TYPE: ${{ needs.resolve-deploy-type.outputs.deploy_type }}
RC_VERSION: ${{ needs.resolve-deploy-type.outputs.rc_version }}
steps:
- name: Checkout repository
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
with:
fetch-tags: ${{ env.DEPLOY_TYPE == 'production' }}
fetch-depth: ${{ env.DEPLOY_TYPE == 'production' && '0' || '1' }}
- uses: pnpm/action-setup@41ff72655975bd51cab0327fa583b6e92b6d3061 # v4.2.0
- name: Install Nodejs
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: "24"
cache: "pnpm"
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: get-npm-version
id: package-version
uses: martinbeentjes/npm-get-version-action@3cf273023a0dda27efcd3164bdfb51908dd46a5b # v1.3.1
with:
path: apps/wallet
- name: Create artifact name
shell: bash
run: |
if [ "$DEPLOY_TYPE" = "rc" ]; then
export artifact_name="iota-wallet-${{ steps.package-version.outputs.current-version }}-rc.${RC_VERSION}"
else
export artifact_name="iota-wallet-${{ steps.package-version.outputs.current-version }}"
fi
echo "artifact_name=${artifact_name}" >> $GITHUB_ENV
- name: Get Previous Tag
if: env.DEPLOY_TYPE == 'production'
id: prev_tag
run: |
tags=$(git tag --list 'wallet-v*.*.*' --sort=-creatordate)
current_tag=$(echo "$tags" | sed -n 1p)
prev_tag=$(echo "$tags" | sed -n 2p)
if [ -z "$prev_tag" ]; then
echo "No previous tag found. Skipping changelog generation."
echo "PREV_TAG=none" >> $GITHUB_ENV
else
echo "PREV_TAG=$prev_tag" >> $GITHUB_ENV
fi
echo "CURRENT_TAG=$current_tag" >> $GITHUB_ENV
- name: Generate Changelog
if: env.DEPLOY_TYPE == 'production'
id: generate_changelog
run: |
if [ "${{ env.PREV_TAG }}" = "none" ]; then
echo "No previous tag found. Skipping changelog generation."
echo "changelog=No previous tag found. Changelog generation skipped." >> $GITHUB_OUTPUT
else
echo "## Changelog" > CHANGELOG.md
git log ${{ env.PREV_TAG }}..${{ env.CURRENT_TAG }} --pretty=format:"- %s in #%h" -- ./apps/wallet >> CHANGELOG.md
cat CHANGELOG.md
fi
- name: Get version from tag
if: env.DEPLOY_TYPE == 'production'
id: version
run: echo "version=${GITHUB_REF#refs/tags/wallet-v}" >> "$GITHUB_OUTPUT"
- name: Build Chrome Wallet
run: |
if [ "$DEPLOY_TYPE" = "rc" ]; then
pnpm wallet build:rc
else
pnpm wallet build
fi
- name: Upload Chrome artifacts
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: chrome-${{ env.artifact_name }}
path: |
./apps/wallet/dist
- name: Build Firefox Wallet
run: |
if [ "$DEPLOY_TYPE" = "rc" ]; then
pnpm wallet build:firefox:rc
else
pnpm wallet build:firefox
fi
- name: Upload Firefox artifacts
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: firefox-${{ env.artifact_name }}
path: |
./apps/wallet/dist
- name: Create GitHub Release
if: env.DEPLOY_TYPE == 'production'
uses: softprops/action-gh-release@01570a1f39cb168c169c802c3bceb9e93fb10974 # v2.1.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.CURRENT_TAG }}
name: IOTA Wallet v${{ steps.version.outputs.version }}
draft: true
prerelease: false
body_path: CHANGELOG.md