|
| 1 | +name: Nightly Release |
| 2 | + |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + # Run at 00:00 UTC every day |
| 6 | + - cron: '0 0 * * *' |
| 7 | + workflow_dispatch: # Allow manual triggering |
| 8 | + pull_request: |
| 9 | + branches: |
| 10 | + - main |
| 11 | + - master |
| 12 | + |
| 13 | +jobs: |
| 14 | + build: |
| 15 | + name: Build Nightly Release |
| 16 | + runs-on: ubuntu-latest |
| 17 | + |
| 18 | + steps: |
| 19 | + - name: Checkout code |
| 20 | + uses: actions/checkout@v4 |
| 21 | + with: |
| 22 | + submodules: recursive |
| 23 | + |
| 24 | + - name: Set up Rust |
| 25 | + uses: actions-rust-lang/setup-rust-toolchain@v1 |
| 26 | + with: |
| 27 | + toolchain: stable |
| 28 | + |
| 29 | + - name: Install wasm-pack |
| 30 | + run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh |
| 31 | + |
| 32 | + - name: Install Node.js |
| 33 | + uses: actions/setup-node@v4 |
| 34 | + with: |
| 35 | + node-version: '20' |
| 36 | + |
| 37 | + - name: Install jsonnet |
| 38 | + run: | |
| 39 | + wget https://github.com/google/go-jsonnet/releases/download/v0.20.0/go-jsonnet_0.20.0_Linux_x86_64.tar.gz |
| 40 | + tar -xzf go-jsonnet_0.20.0_Linux_x86_64.tar.gz |
| 41 | + sudo mv jsonnet /usr/local/bin/ |
| 42 | + sudo chmod +x /usr/local/bin/jsonnet |
| 43 | + jsonnet --version |
| 44 | +
|
| 45 | + - name: Install Node.js dependencies |
| 46 | + run: | |
| 47 | + npm install -g esbuild web-ext |
| 48 | +
|
| 49 | + - name: Build Chrome package |
| 50 | + run: make pack chrome |
| 51 | + |
| 52 | + - name: Build Firefox package |
| 53 | + run: make pack firefox |
| 54 | + |
| 55 | + - name: Build Edge package |
| 56 | + run: make pack edge |
| 57 | + |
| 58 | + - name: Upload build artifacts (PR only) |
| 59 | + if: github.event_name == 'pull_request' |
| 60 | + uses: actions/upload-artifact@v4 |
| 61 | + with: |
| 62 | + name: extension-packages |
| 63 | + path: web-ext-artifacts/*.zip |
| 64 | + retention-days: 7 |
| 65 | + |
| 66 | + - name: Get current date |
| 67 | + if: github.event_name != 'pull_request' |
| 68 | + id: date |
| 69 | + run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT |
| 70 | + |
| 71 | + - name: Get short commit SHA |
| 72 | + if: github.event_name != 'pull_request' |
| 73 | + id: sha |
| 74 | + run: echo "sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT |
| 75 | + |
| 76 | + - name: Create Release |
| 77 | + if: github.event_name != 'pull_request' |
| 78 | + id: create_release |
| 79 | + uses: actions/create-release@v1 |
| 80 | + env: |
| 81 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 82 | + with: |
| 83 | + tag_name: nightly-${{ steps.date.outputs.date }}-${{ steps.sha.outputs.sha }} |
| 84 | + release_name: Nightly Release ${{ steps.date.outputs.date }} |
| 85 | + body: | |
| 86 | + Automated nightly build from commit ${{ github.sha }} |
| 87 | +
|
| 88 | + ## Installation |
| 89 | +
|
| 90 | + ### Chrome/Edge |
| 91 | + 1. Download the Chrome or Edge package |
| 92 | + 2. Extract the zip file |
| 93 | + 3. Open chrome://extensions/ (or edge://extensions/) |
| 94 | + 4. Enable "Developer mode" |
| 95 | + 5. Click "Load unpacked" and select the extracted folder |
| 96 | +
|
| 97 | + ### Firefox |
| 98 | + 1. Download the Firefox package |
| 99 | + 2. Open about:debugging#/runtime/this-firefox |
| 100 | + 3. Click "Load Temporary Add-on" |
| 101 | + 4. Select the downloaded .zip file |
| 102 | +
|
| 103 | + **Note:** This is a nightly build and may contain experimental features or bugs. |
| 104 | + draft: false |
| 105 | + prerelease: true |
| 106 | + |
| 107 | + - name: Find built packages |
| 108 | + if: github.event_name != 'pull_request' |
| 109 | + id: find_packages |
| 110 | + run: | |
| 111 | + echo "chrome_package=$(ls web-ext-artifacts/chrome-rust-search-extension-*.zip)" >> $GITHUB_OUTPUT |
| 112 | + echo "firefox_package=$(ls web-ext-artifacts/firefox-rust-search-extension-*.zip)" >> $GITHUB_OUTPUT |
| 113 | + echo "edge_package=$(ls web-ext-artifacts/edge-rust-search-extension-*.zip)" >> $GITHUB_OUTPUT |
| 114 | +
|
| 115 | + - name: Upload Chrome Release Asset |
| 116 | + if: github.event_name != 'pull_request' |
| 117 | + uses: actions/upload-release-asset@v1 |
| 118 | + env: |
| 119 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 120 | + with: |
| 121 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 122 | + asset_path: ${{ steps.find_packages.outputs.chrome_package }} |
| 123 | + asset_name: chrome-rust-search-extension-nightly-${{ steps.date.outputs.date }}.zip |
| 124 | + asset_content_type: application/zip |
| 125 | + |
| 126 | + - name: Upload Firefox Release Asset |
| 127 | + if: github.event_name != 'pull_request' |
| 128 | + uses: actions/upload-release-asset@v1 |
| 129 | + env: |
| 130 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 131 | + with: |
| 132 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 133 | + asset_path: ${{ steps.find_packages.outputs.firefox_package }} |
| 134 | + asset_name: firefox-rust-search-extension-nightly-${{ steps.date.outputs.date }}.zip |
| 135 | + asset_content_type: application/zip |
| 136 | + |
| 137 | + - name: Upload Edge Release Asset |
| 138 | + if: github.event_name != 'pull_request' |
| 139 | + uses: actions/upload-release-asset@v1 |
| 140 | + env: |
| 141 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 142 | + with: |
| 143 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 144 | + asset_path: ${{ steps.find_packages.outputs.edge_package }} |
| 145 | + asset_name: edge-rust-search-extension-nightly-${{ steps.date.outputs.date }}.zip |
| 146 | + asset_content_type: application/zip |
| 147 | + |
| 148 | + - name: Clean up old nightly releases |
| 149 | + if: github.event_name != 'pull_request' |
| 150 | + uses: dev-drprasad/delete-older-releases@v0.3.2 |
| 151 | + with: |
| 152 | + keep_latest: 1 |
| 153 | + delete_tag_pattern: nightly |
| 154 | + env: |
| 155 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments