Compute BUILD_DIR dynamically #4
Workflow file for this run
This file contains hidden or 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: Build & Release | |
| on: | |
| push: | |
| tags: | |
| - "v*.*.*" | |
| jobs: | |
| build-and-release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout tag | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| ref: ${{ github.ref }} | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| - name: Cache npm modules | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.npm | |
| key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build extension | |
| run: npm run build | |
| - name: "Debug: print key env vars" | |
| run: | | |
| echo "→ HOME: $HOME" | |
| echo "→ BUILD_DIR: $BUILD_DIR" | |
| echo "→ GITHUB_WORKSPACE: $GITHUB_WORKSPACE" | |
| - name: "Debug: list $HOME tree" | |
| run: | | |
| ls -la "$HOME" | |
| ls -la "$HOME/.config" | |
| ls -la "$HOME/.config/raycast" || echo "no raycast folder" | |
| ls -R "$HOME/.config/raycast/extensions" || echo "no extensions folder" | |
| - name: "Debug: list workspace tree" | |
| run: | | |
| ls -R "$GITHUB_WORKSPACE" | sed 's/^/ /' | |
| - name: Compute BUILD_DIR | |
| run: echo "BUILD_DIR=$HOME/.config/raycast/extensions/anytype" >> $GITHUB_ENV | |
| - name: Verify build output | |
| run: | | |
| if [ ! -d "${BUILD_DIR}" ]; then | |
| echo "❌ Build directory '${BUILD_DIR}' not found!" | |
| exit 1 | |
| fi | |
| - name: Compress extension to tar.gz | |
| run: | | |
| TAR_NAME="anytype-raycast-${{ github.ref_name }}.tar.gz" | |
| tar czf "${GITHUB_WORKSPACE}/${TAR_NAME}" --transform "s,^,anytype-raycast-${{ github.ref_name }}/," -C "${BUILD_DIR}" . | |
| - name: Create GitHub Release & Upload Asset | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ github.ref_name }} | |
| name: ${{ github.ref_name }} | |
| files: anytype-raycast-${{ github.ref_name }}.tar.gz | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |