Error handling added #28
Workflow file for this run
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
name: arm_deb_packager | |
on: | |
workflow_dispatch: | |
release: | |
types: [released, prereleased] | |
push: | |
branches: | |
- SPEC-161-miden-deployment-fix-from-package | |
jobs: | |
build_package: | |
permissions: | |
id-token: write | |
contents: write | |
outputs: | |
target: ${{ steps.build_type_vars_setup.outputs.target }} | |
tag: ${{ steps.build_type_vars_setup.outputs.tag }} | |
account_id: ${{ steps.build_type_vars_setup.outputs.account_id }} | |
instance_id: ${{ steps.build_type_vars_setup.outputs.instance_id }} | |
runs-on: | |
labels: ubuntu22-arm-4core | |
steps: | |
- name: Checkout | |
uses: actions/checkout@main | |
with: | |
fetch-depth: 0 | |
- name: Adding TAG to ENV | |
run: | | |
if [[ ${{ github.event_name }} == "release" || ${{ github.event_name }} == "prereleased" ]]; then | |
echo "GIT_TAG=`echo $(git describe --tags --abbrev=0)`" >> $GITHUB_ENV | |
else | |
echo "GIT_TAG=next" >> $GITHUB_ENV | |
fi | |
- name: adding version | |
run: | | |
if [[ ${{ github.event_name }} == "release" || ${{ github.event_name }} == "prereleased" ]]; then | |
NUMERIC_VERSION=$( echo ${{ env.GIT_TAG }} | sed 's/[^0-9.]//g' ) | |
echo "VERSION=$NUMERIC_VERSION" >> $GITHUB_ENV | |
else | |
echo "VERSION=0.1" >> $GITHUB_ENV | |
fi | |
- name: cleaning repo | |
run: cargo clean | |
- name: Building for arm64 | |
run: | | |
cargo build --release --locked --features testing --bin miden-node | |
cargo build --release --locked --features testing --bin miden-faucet | |
- name: create package directories | |
run: | | |
mkdir -p packaging/deb/miden-node/DEBIAN | |
mkdir -p packaging/deb/miden-node/usr/bin | |
mkdir -p packaging/deb/miden-node/lib/systemd/system | |
mkdir -p packaging/deb/miden-node/etc/miden | |
mkdir -p packaging/deb/miden-node/opt/miden/miden-node | |
- name: copy package files | |
run: | | |
cp -p target/release/miden-node packaging/deb/miden-node/usr/bin/ | |
cp packaging/miden-node.service packaging/deb/miden-node/lib/systemd/system/ | |
cp packaging/postinst packaging/deb/miden-node/DEBIAN/postinst | |
cp packaging/postrm packaging/deb/miden-node/DEBIAN/postrm | |
########### Control file creation for arm64 miden-node########## | |
- name: create control file | |
run: | | |
touch packaging/deb/miden-node/DEBIAN/control | |
echo "Package: miden-node" >> packaging/deb/miden-node/DEBIAN/control | |
echo "Version: ${{ env.VERSION }}" >> packaging/deb/miden-node/DEBIAN/control | |
echo "Section: base" >> packaging/deb/miden-node/DEBIAN/control | |
echo "Priority: optional" >> packaging/deb/miden-node/DEBIAN/control | |
echo "Architecture: arm64" >> packaging/deb/miden-node/DEBIAN/control | |
echo "Maintainer: Polygon Devops <[email protected]>" >> packaging/deb/miden-node/DEBIAN/control | |
echo "Description: miden-node binary package" >> packaging/deb/miden-node/DEBIAN/control | |
echo "Homepage: https://polygon.technology/polygon-miden" >> packaging/deb/miden-node/DEBIAN/control | |
echo "Vcs-Git: [email protected]:0xPolygonMiden/miden-node.git" >> packaging/deb/miden-node/DEBIAN/control | |
echo "Vcs-Browser: https://github.com/0xPolygonMiden/miden-node" >> packaging/deb/miden-node/DEBIAN/control | |
- name: Creating package for binary for miden-node ${{ env.ARCH }} | |
run: cp -rp packaging/deb/miden-node packaging/deb/miden-node-${{ env.GIT_TAG }}-${{ env.ARCH }} | |
env: | |
ARCH: arm64 | |
- name: Running package build | |
run: dpkg-deb --build --root-owner-group packaging/deb/miden-node-${{ env.GIT_TAG }}-${{ env.ARCH }} | |
env: | |
ARCH: arm64 | |
########## Miden Faucet Package ########################################## | |
- name: create package directories | |
run: | | |
mkdir -p packaging/deb/miden-faucet/DEBIAN | |
mkdir -p packaging/deb/miden-faucet/usr/bin | |
mkdir -p packaging/deb/miden-faucet/lib/systemd/system | |
mkdir -p packaging/deb/miden-faucet/etc/miden | |
mkdir -p packaging/deb/miden-faucet/opt/miden/miden-faucet | |
- name: copy package files | |
run: | | |
cp -p target/release/miden-faucet packaging/deb/miden-faucet/usr/bin/ | |
cp packaging/miden-faucet.service packaging/deb/miden-faucet/lib/systemd/system/ | |
cp packaging/postinst packaging/deb/miden-faucet/DEBIAN/postinst | |
cp packaging/postrm.faucet packaging/deb/miden-faucet/DEBIAN/postrm | |
########### Control file creation for arm64 miden-faucet ########## | |
- name: create control file | |
run: | | |
touch packaging/deb/miden-faucet/DEBIAN/control | |
echo "Package: miden-faucet" >> packaging/deb/miden-faucet/DEBIAN/control | |
echo "Version: ${{ env.VERSION }}" >> packaging/deb/miden-faucet/DEBIAN/control | |
echo "Section: base" >> packaging/deb/miden-faucet/DEBIAN/control | |
echo "Priority: optional" >> packaging/deb/miden-faucet/DEBIAN/control | |
echo "Architecture: arm64" >> packaging/deb/miden-faucet/DEBIAN/control | |
echo "Maintainer: Polygon Devops <[email protected]>" >> packaging/deb/miden-faucet/DEBIAN/control | |
echo "Description: miden-faucet binary package" >> packaging/deb/miden-faucet/DEBIAN/control | |
echo "Homepage: https://polygon.technology/polygon-miden" >> packaging/deb/miden-faucet/DEBIAN/control | |
echo "Vcs-Git: [email protected]:0xPolygonMiden/miden-node.git" >> packaging/deb/miden-faucet/DEBIAN/control | |
echo "Vcs-Browser: https://github.com/0xPolygonMiden/miden-node" >> packaging/deb/miden-faucet/DEBIAN/control | |
- name: Creating package for binary for miden-faucet ${{ env.ARCH }} | |
run: cp -rp packaging/deb/miden-faucet packaging/deb/miden-faucet-${{ env.GIT_TAG }}-${{ env.ARCH }} | |
env: | |
ARCH: arm64 | |
- name: Running package build | |
run: dpkg-deb --build --root-owner-group packaging/deb/miden-faucet-${{ env.GIT_TAG }}-${{ env.ARCH }} | |
env: | |
ARCH: arm64 | |
- name: shasum the package | |
run: cd packaging/deb/ && sha256sum miden-node-${{ env.GIT_TAG }}-${{ env.ARCH }}.deb > miden-node-${{ env.GIT_TAG }}-${{ env.ARCH }}.deb.checksum | |
env: | |
ARCH: arm64 | |
- name: shasum the package | |
run: cd packaging/deb/ && sha256sum miden-faucet-${{ env.GIT_TAG }}-${{ env.ARCH }}.deb > miden-faucet-${{ env.GIT_TAG }}-${{ env.ARCH }}.deb.checksum | |
env: | |
ARCH: arm64 | |
- name: release miden-node Packages for testnet | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: ${{ env.GIT_TAG }} | |
prerelease: true | |
files: | | |
packaging/deb/miden-node**.deb | |
packaging/deb/miden-node**.deb.checksum | |
packaging/deb/miden-faucet**.deb | |
packaging/deb/miden-faucet**.deb.checksum | |
if: ${{ github.event_name == 'release' || github.event_name == 'prereleased' }} | |
- name: release miden-node Packages for devnet | |
uses: actions/upload-artifact@v3 | |
with: | |
name: devnet_package | |
path: | | |
packaging/deb/miden-node-${{ env.GIT_TAG }}-${{ env.ARCH }}.deb | |
packaging/deb/miden-node-${{ env.GIT_TAG }}-${{ env.ARCH }}.deb.checksum | |
packaging/deb/miden-faucet-${{ env.GIT_TAG }}-${{ env.ARCH }}.deb | |
packaging/deb/miden-faucet-${{ env.GIT_TAG }}-${{ env.ARCH }}.deb.checksum | |
env: | |
ARCH: arm64 | |
if: ${{ github.event_name == 'push' }} | |
- name: Determine build type | |
id: build_type_vars_setup | |
run: | | |
if [[ ${{ github.event_name }} == "release" || ${{ github.event_name }} == "prereleased" ]]; then | |
echo "target=testnet" >> $GITHUB_OUTPUT | |
echo "tag=${{ env.GIT_TAG }}" >> $GITHUB_OUTPUT | |
echo "account_id=MIDEN_DEV_ACCOUNT_ID" >> $GITHUB_OUTPUT | |
echo "instance_id=TESTNET_INSTANCE_ID" >> $GITHUB_OUTPUT | |
else | |
echo "target=devnet" >> $GITHUB_OUTPUT | |
echo "tag=next" >> $GITHUB_OUTPUT | |
echo "account_id=MIDEN_DEV_ACCOUNT_ID" >> $GITHUB_OUTPUT | |
echo "instance_id=DEVNET_INSTANCE_ID" >> $GITHUB_OUTPUT | |
fi | |
deploy: | |
name: Deploy to ${{ needs.build_package.outputs.target }} | |
needs: build_package | |
uses: ./.github/workflows/deploy_package.yml | |
with: | |
target: ${{ needs.build_package.outputs.target }} | |
tag: ${{ needs.build_package.outputs.tag }} | |
account_id: ${{ needs.build_package.outputs.account_id }} | |
instance_id: ${{ needs.build_package.outputs.instance_id }} | |
secrets: inherit |