原始 MediaWiki 页面

我知道编辑这个网站吗?
the ImageJ2 platform本页介绍与 the ImageJ2 platform 相关的内容。点击徽标查看详情。

自动更新网站上传

自迁移出 MediaWiki 以来,本页内容尚未经过审查。如果您愿意帮忙,请查看帮助指南

This guide is intended for maintaining non-core update sites by automating builds with GitHub Actions.

  • The core update sites are updated manually or automatically. Automated update is performed with GitHub Actions.
  • GitHub Actions is useful because it can freely build any open source project with minimal effort.

要求

其他资源

通过 GitHub Actions 自动上传

GitHub Actions 可用于自动构建存储库以响应代码更改。为了简化 ImageJ 更新站点的维护,我们可以使用 GitHub Actions 自动上传站点的最新版本。这是通过在更新站点的 GitHub 存储库中创建一个 .github/workflows/release.yml 文件来完成的,该文件执行以下操作:

  1. 创建一个新的ImageJ2.app
  2. 构建更新站点的存储库并将所需的工件(例如.jars)移动到 ImageJ2.app 中的预期位置
  3. 将本地更新站点状态上传到您的Wiki更新站点

作为起点,您可以复制以下.github/workflows/release.yml


name: Release to Update Site

on:
  push:
    branches: [master]  # Trigger the workflow on push to the master branch

jobs:
  build_release:
    runs-on: ubuntu-latest
    env:
      IJ_DOWNLOAD_URL: https://downloads.imagej.net/fiji/latest/fiji-linux64.zip
      WIKI_USER: YOUR_USER_NAME
      UPDATE_PASS: ${{ secrets.UPDATE_PASS }}  # DO NOT WRITE your password here
      UPDATE_SITE: YOUR_UPDATE_SITE_NAME
    steps:
      - name: Checkout
        uses: actions/checkout@v2
      - name: Build with Maven
        run: mvn -B package
      - name: Install ImageJ/Fiji
        run: |
          curl --silent -O ${IJ_DOWNLOAD_URL}
          unzip fiji-linux64.zip
          ./Fiji.app/ImageJ-linux64 --headless --update edit-update-site ${UPDATE_SITE} https://sites.imagej.net/${UPDATE_SITE}/ "webdav:${WIKI_USER}:${UPDATE_PASS}" .
      - name: Install in ImageJ/Fiji (with Maven)
        run: mvn -B install -Dscijava.app.directory=./Fiji.app -Ddelete.other.versions=true -Dscijava.ignoreDependencies=true
      - name: Release to ImageJ update site
        run: |
          ./Fiji.app/ImageJ-linux64 --headless --update upload-complete-site --force ${UPDATE_SITE}

不要忘记用您的信息替换 WIKI_USERUPDATE_SITE 变量。

加密你的密码

要上传到您的 wiki 更新站点,您需要向 GitHub Actions 提供 UPDATE_PASS 环境变量,该变量应评估为执行上传的 Wiki 帐户的upload password。为了安全地执行此操作,请遵循creating encrypted secrets for a repository中的说明。

非 Maven 化文件

GitHub Actions 还能够构建除 Java 之外的多种语言。如果您无法将 Maven 与 scijava.app.directory 一起使用,那么您需要替换 .github/workflows/release.yml 的以下行:

mvn -B install -Dscijava.app.directory=./Fiji.app -Ddelete.other.versions=true -Dscijava.ignoreDependencies=true

使用一系列命令将您的构建工件移动到适合您​​的更新站点的 ./Fiji.app/jars./Fiji.app/plugins 目录。

如果您有自定义脚本、宏等,情况也是如此……如果这些文件没有出现在本地 ImageJ2.app 的正确位置,它们将看起来已被删除。

注意事项

USE CAUTION HERE

  1. You are configuring GitHub Actions to upload the state of an ImageJ installation to your update site. The ImageJ2.app that will be uploaded is located at ./Fiji.app with respect to the current working directory of the virtual machine GitHub Actions is running on. If your build artifacts are not located in the ./Fiji.app/jars or ./Fiji.app/plugins directory, or you don’t manually copy scripts to the correct location, ImageJ will see these items as having been deleted—effectively removing all content from your update site. You can mitigate this danger by customizing your release.yml to download your own update site into the base ImageJ2.app; only changes to the update site state will be uploaded.
  2. By default—building the master branch of your repository—your update site will be updated with every change to the source code. Although we encourage the master branch to be “release ready”, a safer practice would be to configure GitHub Actions to only build specific events—and set it to build release versions only—e.g. with a release version integration branch.
  3. Using the Maven-based release.yml as suggested implies that you are conforming to the managed dependencies of the parent pom.xml. If you are not staying up-to-date with the ImageJ and Fiji update sites (by using the latest ImageJ or Fiji bill of materials) then this automation may break your own update site.