Skip to content

Release nightly

Release nightly #20

Workflow file for this run

name: Release nightly
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * 2-6'
permissions:
actions: write
contents: write
pull-requests: write
jobs:
prepare-release:
runs-on: ubuntu-latest
outputs:
sha: ${{ steps.commit.outputs.sha }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Configure Git
run: |
git config --global user.name GitHub Actions
git config user.email [email protected]
- uses: knope-dev/action@407e9ef7c272d2dd53a4e71e39a7839e29933c48 # v2.1.0
with:
version: 0.18.0
- run: knope prepare-nightly --verbose
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
continue-on-error: true
- name: Store commit
id: commit
run: echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
build:
needs: prepare-release
strategy:
matrix:
include:
- os: ubuntu-20.04
target: x86_64-unknown-linux-gnu
code-target: linux-x64
- os: macos-14
target: aarch64-apple-darwin
code-target: darwin-arm64
name: Package ${{ matrix.code-target }}
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: ${{ needs.prepare-release.outputs.sha }}
- name: Install Node.js
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with:
node-version: 20
- name: Install toolchain
uses: moonrepo/setup-rust@e013866c4215f77c925f42f60257dec7dd18836e # v1.2.1
with:
channel: stable
cache-target: release
cache-base: main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Audit crates.io dependencies
if: matrix.code-target == 'linux-x64'
run: cargo audit
- name: Set jemalloc page size for linux-arm64
if: matrix.code-target == 'linux-arm64'
run: |
echo "JEMALLOC_SYS_WITH_LG_PAGE=16" >> $GITHUB_ENV
# Build the CLI binary
- name: Build binaries
run: cargo build -p cli --release --target ${{ matrix.target }}
env:
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER: aarch64-linux-gnu-gcc
# Strip all debug symbols from the resulting binaries
RUSTFLAGS: "-C strip=symbols -C codegen-units=1"
# Copy the CLI binary and rename it to include the name of the target platform
# - name: Copy CLI binary
# if: matrix.os == 'windows-2022'
# run: |
# mkdir dist
# cp target/${{ matrix.target }}/release/cli.exe ./dist/cli-${{ matrix.code-target }}.exe
# - name: Copy CLI binary
# if: matrix.os != 'windows-2022'
# run: |
# mkdir dist
# cp target/${{ matrix.target }}/release/cli ./dist/cli-${{ matrix.code-target }}
# - name: Upload Artifact
# uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
# with:
# name: cli-${{ matrix.target }}
# path: ./dist/cli-*
# if-no-files-found: error
release:
name: Publish
runs-on: ubuntu-latest
needs: [build, prepare-release]
environment: npm-publish
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: ${{ needs.prepare-release.outputs.sha }}
# - name: Download CLI artifacts
# uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
# with:
# pattern: cli-*
# merge-multiple: true
- uses: knope-dev/action@407e9ef7c272d2dd53a4e71e39a7839e29933c48 # v2.1.0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- run: knope release --verbose
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish-npm:
name: Publish npm packages
runs-on: ubuntu-latest
needs: release
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
# - name: Download CLI artifacts
# uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
# with:
# pattern: cli-*
# merge-multiple: true
- name: "Fake Publish"
run: echo "Fake Publish CLI"
publish-crates:
name: Publish crates
needs: release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: ${{ needs.prepare-release.outputs.sha }}
- name: Install toolchain
uses: moonrepo/setup-rust@e013866c4215f77c925f42f60257dec7dd18836e # v1.2.1
with:
channel: stable
cache-target: release
cache-base: main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: katyo/publish-crates@v2
with:
no-verify: true
dry-run: true
check-repo: true