build-release.yml 3.2 Ko
Télécharger le fichier
name: Build & Publish Client Release
on:
push:
branches: [main]
workflow_dispatch:
permissions:
contents: write
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: 'true'
OCTANE_SINGLE_BUNDLE: '1'
OCTANE_JSON_MODE: 'legacy'
jobs:
# The renderer lives in a private repo, so this workflow can only run where
# DUCKET_REPO_TOKEN is available. Without this gate actions/checkout fails with
# an opaque "Input required and not supplied: token" and turns the run red on
# every fork and on any repo that has not been given the secret.
check-access:
runs-on: ubuntu-latest
outputs:
has-token: ${{ steps.check.outputs.has-token }}
steps:
- name: Check for renderer access token
id: check
env:
DUCKET_REPO_TOKEN: ${{ secrets.DUCKET_REPO_TOKEN }}
run: |
if [ -n "$DUCKET_REPO_TOKEN" ]; then
echo "has-token=true" >> "$GITHUB_OUTPUT"
else
echo "has-token=false" >> "$GITHUB_OUTPUT"
echo "::notice::DUCKET_REPO_TOKEN is not set — skipping the client release build."
fi
build-release:
needs: check-access
if: needs.check-access.outputs.has-token == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout client
uses: actions/checkout@v7
with:
path: octane
- name: Checkout renderer
uses: actions/checkout@v7
with:
repository: duckethotel/ducket-render
ref: main
path: octane-renderer
token: ${{ secrets.DUCKET_REPO_TOKEN }}
- name: Set up Node.js
uses: actions/setup-node@v7
with:
node-version-file: 'octane/.nvmrc'
- name: Enable Corepack
run: corepack enable
- name: Install renderer dependencies
working-directory: octane-renderer
run: yarn install --frozen-lockfile
- name: Install client dependencies
env:
COREPACK_ENABLE_DOWNLOAD_PROMPT: '0'
working-directory: octane
run: corepack yarn install --immutable
- name: Link renderer into client
run: |
mkdir -p octane/node_modules/@octane
ln -sfn "${{ github.workspace }}/octane-renderer" octane/node_modules/@octane/renderer
- name: Build client
working-directory: octane
run: yarn build
- name: Read package version
id: version
working-directory: octane
run: |
VERSION=$(node -p "require('./package.json').version")
SHORT_SHA=${GITHUB_SHA::7}
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "short_sha=$SHORT_SHA" >> "$GITHUB_OUTPUT"
- name: Package dist
working-directory: octane
run: |
zip -r "../ducket-client-dist-${{ steps.version.outputs.short_sha }}.zip" dist
- name: Publish release
uses: softprops/action-gh-release@v3
with:
tag_name: client-v${{ steps.version.outputs.version }}-${{ steps.version.outputs.short_sha }}
name: Ducket Client ${{ steps.version.outputs.version }} (${{ steps.version.outputs.short_sha }})
generate_release_notes: true
files: ducket-client-dist-${{ steps.version.outputs.short_sha }}.zip
