Skip to content

workflow

workflow #37

Workflow file for this run

name: Release
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
on:
push:
branches:
- "main"
# on:
# workflow_dispatch:
# inputs:
# bin-codename:
# # Use the names of planes in increasing increments of speed
# description: 'Binary Release Codename'
# required: false
# default: ""
# type: string
env:
BIN_CODENAME: ${{ inputs.bin-codename }}
jobs:
vars:
name: "🧠 Generate Variables"
runs-on: ubuntu-latest
outputs:
BRANCH_NAME: ${{ steps.step1.outputs.BRANCH_NAME }}
NPM_TAG: ${{ steps.step1.outputs.NPM_TAG }}
NEXT_MACH_VERSION: ${{ steps.step1.outputs.NEXT_MACH_VERSION }}
steps:
- uses: actions/checkout@v4
- id: step1
run: |
npm install -g pnpm && pnpm i
export BRANCH_NAME=${GITHUB_REF##*/}
export NPM_TAG=$BRANCH_NAME
if [ $NPM_TAG = "main" ]; then
export NPM_TAG="latest"
fi
NEXT_MACH_VERSION="$(node .github/scripts/ci/next-npm-version.mjs)"
echo "NEXT_MACH_VERSION=$NEXT_MACH_VERSION" >> $GITHUB_OUTPUT
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_OUTPUT
echo "NPM_TAG=$NPM_TAG" >> $GITHUB_OUTPUT
echo NEXT_MACH_VERSION = $NEXT_MACH_VERSION
echo NPM_TAG = $NPM_TAG
echo BRANCH_NAME = $BRANCH_NAME
linux-amd64:
name: "πŸ₯ Linux AMD64"
runs-on: ubuntu-latest
needs: [vars]
steps:
- uses: actions/checkout@v4
- uses: extractions/setup-just@v2
- uses: actions/setup-node@v4
with: { node-version: 20 }
- name: Build
env:
MACH_VERSION: ${{ needs.vars.outputs.NEXT_MACH_VERSION }}
run: |
set -ev
sudo apt-get update
npm install -g npm pnpm
pnpm install
rustup target add x86_64-unknown-linux-gnu
profile=release os=linux arch=amd64 just build-publish
mkdir ${{ github.workspace }}/artifact
cd ${{ github.workspace }}/target/linux-amd64
mv release mach
tar -czvf mach-linux-amd64.tar.gz mach
mv mach-linux-amd64.tar.gz ${{ github.workspace }}/artifact
cd ${{ github.workspace }}/npm/mach-os-arch
npm pack
mv *.tgz npm-mach-linux-amd64.tgz
mv *.tgz ${{ github.workspace }}/artifact/npm-mach-linux-amd64.tgz
ls -l ${{ github.workspace }}/artifact
- uses: actions/upload-artifact@v4
with:
name: ${{ github.job }}.tar.gz
path: ${{ github.workspace }}/artifact/**/*
if-no-files-found: error
retention-days: 1
# linux-arm64:
# name: "πŸ₯ Linux ARM64"
# runs-on: ubuntu-latest
# needs: [vars]
# steps:
# - uses: actions/checkout@v4
# - uses: actions/setup-node@v4
# with: { node-version: 20 }
# - name: Setup Dependencies
# run: |
# sudo apt-get update
# npm install -g npm pnpm
# pnpm install
# sudo apt-get install gcc-aarch64-linux-gnu build-essential
# rustup target add aarch64-unknown-linux-gnu
# aarch64-linux-gnu-gcc --version
# - name: Build
# env:
# BIN_VERSION: ${{ needs.vars.outputs.NEXT_BIN_VERSION }}
# run: |
# export CC=aarch64-linux-gnu-gcc
# node .github/scripts/run.mjs build --profile release-lto --target aarch64-unknown-linux-gnu
# - name: Package
# run: |
# cd target/linux-arm64
# mv release-lto mach
# tar -czvf mach-linux-arm64.tar.gz mach
# - uses: actions/upload-artifact@v4
# with:
# name: ${{ github.job }}.tar.gz
# path: target/linux-arm64/mach-linux-arm64.tar.gz
# if-no-files-found: error
# retention-days: 1
# macos-amd64:
# name: "🍎 MacOS AMD64"
# runs-on: macos-13
# needs: [vars]
# steps:
# - uses: actions/checkout@v4
# - uses: actions/setup-node@v4
# with: { node-version: 20 }
# - name: Setup Dependencies
# run: |
# npm install -g npm pnpm
# pnpm install
# rustup target add x86_64-apple-darwin
# - name: Build
# env:
# BIN_VERSION: ${{ needs.vars.outputs.NEXT_BIN_VERSION }}
# run: |
# node .github/scripts/run.mjs build --profile release-lto --target x86_64-apple-darwin
# - name: Package
# run: |
# cd target/macos-amd64
# mv release-lto mach
# tar -czvf mach-macos-amd64.tar.gz mach
# - uses: actions/upload-artifact@v4
# with:
# name: ${{ github.job }}.tar.gz
# path: target/macos-amd64/mach-macos-amd64.tar.gz
# if-no-files-found: error
# retention-days: 1
# macos-arm64:
# name: "🍎 MacOS ARM64"
# runs-on: macos-14
# needs: [vars]
# steps:
# - uses: actions/checkout@v4
# - uses: actions/setup-node@v4
# with: { node-version: 20 }
# - name: Setup Dependencies
# run: |
# npm install -g npm pnpm
# pnpm install
# rustup target add aarch64-apple-darwin
# - name: Build
# env:
# BIN_VERSION: ${{ needs.vars.outputs.NEXT_BIN_VERSION }}
# run: |
# node .github/scripts/run.mjs build --profile release-lto --target aarch64-apple-darwin
# - name: Package
# run: |
# cd target/macos-arm64
# mv release-lto mach
# tar -czvf mach-macos-arm64.tar.gz mach
# - uses: actions/upload-artifact@v4
# with:
# name: ${{ github.job }}.tar.gz
# path: target/macos-arm64/mach-macos-arm64.tar.gz
# if-no-files-found: error
# retention-days: 1
# windows-amd64:
# name: "🟦 Windows AMD64"
# runs-on: windows-latest
# needs: [vars]
# steps:
# - uses: actions/checkout@v4
# - uses: actions/setup-node@v4
# with: { node-version: 20 }
# - name: Setup Dependencies
# run: |
# npm install -g npm pnpm
# pnpm install
# rustup target add x86_64-pc-windows-msvc
# - name: Build
# env:
# BIN_VERSION: ${{ needs.vars.outputs.NEXT_BIN_VERSION }}
# run: |
# node .github/scripts/run.mjs build --profile release-lto --target x86_64-pc-windows-msvc
# - name: Package
# run: |
# cd target/windows-amd64
# mv release-lto mach
# tar -czvf mach-windows-amd64.tar.gz mach
# - uses: actions/upload-artifact@v4
# with:
# name: ${{ github.job }}.tar.gz
# path: target/windows-amd64/mach-windows-amd64.tar.gz
# if-no-files-found: error
# retention-days: 1
# windows-arm64:
# name: "🟦 Windows ARM64"
# runs-on: windows-latest
# needs: [vars]
# steps:
# - uses: actions/checkout@v4
# - uses: actions/setup-node@v4
# with: { node-version: 20 }
# - name: Setup Dependencies
# run: |
# npm install -g npm pnpm
# pnpm install
# rustup target add aarch64-pc-windows-msvc
# - name: Build
# env:
# BIN_VERSION: ${{ needs.vars.outputs.NEXT_BIN_VERSION }}
# run: |
# node .github/scripts/run.mjs build --profile release-lto --target aarch64-pc-windows-msvc
# - name: Package
# run: |
# cd target/windows-arm64
# mv release-lto mach
# tar -czvf mach-windows-arm64.tar.gz mach
# - uses: actions/upload-artifact@v4
# with:
# name: ${{ github.job }}.tar.gz
# path: target/windows-arm64/mach-windows-arm64.tar.gz
# if-no-files-found: error
# retention-days: 1
# npm-package:
# name: "πŸ“¦ NPM"
# runs-on: ubuntu-latest
# needs: [vars]
# steps:
# - uses: actions/checkout@v4
# - uses: actions/setup-node@v4
# with: { node-version: 20 }
# - name: Build NPM
# env:
# BIN_VERSION: ${{ needs.vars.outputs.NEXT_BIN_VERSION }}
# NPM_VERSION: ${{ needs.vars.outputs.NEXT_NPM_VERSION }}
# NPM_BIN_TARGET: ${{ needs.vars.outputs.BRANCH_NAME }}
# run: |
# if [ "$PUBLISH_NPM" != "true" ]; then
# exit 0
# fi
# npm install -g npm pnpm
# pnpm install
# node .github/scripts/run.mjs build
# echo "NPM_VERSION = $NPM_VERSION"
# echo "NPM_BIN_TARGET = $NPM_BIN_TARGET"
# cd npm/mach
# node ./_scripts/prepack/prepack.mjs
# rm -rf ./_scripts/prepack
# npm pack
# mv *.tgz ../../mach-npm.tgz
# - uses: actions/upload-artifact@v4
# with:
# name: mach-npm.tgz
# path: mach-npm.tgz
# if-no-files-found: error
# retention-days: 1
# publish-github-release:
# name: "πŸ” Github Release"
# runs-on: ubuntu-latest
# needs: [vars, npm-package, linux-amd64, linux-arm64, macos-amd64, macos-arm64, windows-amd64, windows-arm64]
# steps:
# - uses: actions/checkout@v4
# - uses: actions/download-artifact@v4
# - name: Publish` Github Release
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# BIN_VERSION: ${{ needs.vars.outputs.NEXT_BIN_VERSION }}
# BRANCH_NAME: ${{ needs.vars.outputs.BRANCH_NAME }}
# run: |
# if [ "$PUBLISH_BIN" != "true" ]; then
# echo Skipping publish
# exit 0
# fi
# gh release create $BIN_VERSION --draft --notes "Automatically built binaries"
# if [ "$BRANCH_NAME" == "main" ]; then
# if [ "$BIN_CODENAME" != "" ]; then
# gh release edit $BIN_VERSION --title "πŸš€ Mach - $BIN_CODENAME"
# else
# gh release edit $BIN_VERSION --title "πŸš€ Mach"
# fi
# else
# gh release edit $BIN_VERSION --prerelease
# gh release edit $BIN_VERSION --title "πŸ§ͺ Branch: $BRANCH_NAME"
# fi
# gh release upload $BIN_VERSION linux-amd64.tar.gz/mach-linux-amd64.tar.gz
# gh release upload $BIN_VERSION linux-arm64.tar.gz/mach-linux-arm64.tar.gz
# gh release upload $BIN_VERSION macos-amd64.tar.gz/mach-macos-amd64.tar.gz
# gh release upload $BIN_VERSION macos-arm64.tar.gz/mach-macos-arm64.tar.gz
# gh release upload $BIN_VERSION windows-amd64.tar.gz/mach-windows-amd64.tar.gz
# gh release upload $BIN_VERSION windows-arm64.tar.gz/mach-windows-arm64.tar.gz
# gh release edit $BIN_VERSION --draft=false
# publish-npm-package:
# name: "πŸ” Publish: NPM"
# runs-on: ubuntu-latest
# needs: [vars, linux-amd64]
# # needs: [vars, npm-package, linux-amd64, linux-arm64, macos-amd64, macos-arm64, windows-amd64, windows-arm64]
# steps:
# - uses: actions/checkout@v4
# - uses: actions/download-artifact@v4
# - name: Publish NPM Package
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
# BRANCH_NAME: ${{ needs.vars.outputs.BRANCH_NAME }}
# run: |
# if [ "$PUBLISH_NPM" != "true" ]; then
# exit 0
# fi
# npm install -g npm pnpm
# echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >> $HOME/.npmrc
# if [ "$BRANCH_NAME" == "main" ]; then
# echo Publishing latest tag
# npm publish --access=public ./mach-npm.tgz/mach-npm.tgz
# else
# echo Publishing $BRANCH_NAME tag
# npm publish --access=public --tag="$BRANCH_NAME" ./mach-npm.tgz/mach-npm.tgz
# fi