Skip to content

release

release #216

Workflow file for this run

# mostly copied from https://raw.githubusercontent.com/web-infra-dev/oxc/main/.github/workflows/release_cli.yml
name: release
on:
workflow_run:
workflows: [test]
types: [completed]
branches: [main]
workflow_dispatch:
concurrency:
group: "release"
cancel-in-progress: true
permissions:
contents: write
id-token: write
jobs:
tag:
runs-on: ubuntu-latest
needs: [build]
steps:
- uses: actions/checkout@v4
- name: Tag
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag -fa canary -m "Latest Continuous Release" ${GITHUB_SHA}
git push --force origin canary:refs/tags/canary
build:
if: |
${{
github.event_name == 'workflow_dispatch' ||
(
github.event.workflow_run.conclusion == 'success' &&
github.repository_owner == 'keithamus' &&
github.ref_name == 'main'
)
}}
strategy:
matrix:
include:
- os: windows-latest
target: x86_64-pc-windows-msvc
code-target: win32-x64
- os: windows-latest
target: aarch64-pc-windows-msvc
code-target: win32-arm64
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
code-target: linux-x64
- os: ubuntu-20.04
target: aarch64-unknown-linux-gnu
code-target: linux-arm64
- os: macos-latest
target: x86_64-apple-darwin
code-target: darwin-x64
- os: macos-latest
target: aarch64-apple-darwin
code-target: darwin-arm64
name: Package ${{ matrix.code-target }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- run: rustup target add ${{ matrix.target }}
- name: Install arm64 toolchain
if: matrix.code-target == 'linux-arm64'
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu
- name: Cache
uses: Swatinem/rust-cache@v2
with:
shared-key: release-${{ matrix.target }}
- name: Build Binary
# strip debug symbols from std, see https://github.com/johnthagen/min-sized-rust#remove-panic-string-formatting-with-panic_immediate_abort
run: cargo build --release --target ${{ matrix.target }} -p hdx
env:
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
- name: Archive Binary
if: runner.os == 'Windows'
shell: bash
run: |
BIN_NAME=hdx-${{ matrix.code-target }}
mv target/${{ matrix.target }}/release/hdx.exe $BIN_NAME.exe
- name: Archive Binary
if: runner.os != 'Windows'
run: |
BIN_NAME=hdx-${{ matrix.code-target }}
mv target/${{ matrix.target }}/release/hdx $BIN_NAME
- run: chmod +x hdx-*
- name: Upload Binary
uses: actions/upload-artifact@v4
with:
if-no-files-found: error
name: binary-${{ matrix.code-target }}
path: hdx-*
deploy:
env:
TAG_NAME: ${{ format('0.0.0-canary.{0}', github.SHA) }}
DIST_TAG: canary
runs-on: ubuntu-latest
needs: [build]
steps:
- run: echo "TAG_NAME=$TAG_NAME"; echo "DIST_TAG=$DIST_TAG"
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
registry-url: https://registry.npmjs.org/
node-version: 18.x
cache-dependency-path: ./website/package.json
cache: "npm"
- name: Download Artifacts
uses: actions/download-artifact@v4
- run: cp binary-*/* packages/hdx/bin
- run: tree
- run: npm i
working-directory: ./packages/hdx
- run: npm version ${TAG_NAME} --no-git-tag-version
working-directory: ./packages/hdx
- run: npm whoami; npm pub --provenance --tag $DIST_TAG --access public
working-directory: ./packages/hdx
env:
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
- name: Update Release
uses: softprops/action-gh-release@v2
with:
name: Canary
prerelease: true
tag_name: canary
target_commitish: ${{ github.sha }}
files: binary-*/*
token: ${{ secrets.GITHUB_TOKEN }}
body: |
This release is automatically built and generated on every commit to main that passes tests.
And is currently published to npm:
```shell
npm i hdx@canary
```