├── .github ├── CODEOWNERS └── workflows │ └── backup.yml ├── LICENSE ├── README.md └── action.yml /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @julia-actions/reviewers 2 | -------------------------------------------------------------------------------- /.github/workflows/backup.yml: -------------------------------------------------------------------------------- 1 | name: Backup 2 | 3 | on: 4 | schedule: 5 | - cron: '5 4 * * 0' 6 | 7 | workflow_dispatch: 8 | 9 | jobs: 10 | backup: 11 | runs-on: ubuntu-20.04 12 | 13 | steps: 14 | - name: Configure cache 15 | uses: actions/cache@v2 16 | with: 17 | path: | 18 | ${{ env.GITHUB_WORKSPACE }} 19 | ~/.cache/restic 20 | key: ${{ runner.os }} 21 | 22 | - name: Install the correct Python version 23 | uses: actions/setup-python@v2 24 | with: 25 | python-version: '3.x' 26 | 27 | - name: Run backup action 28 | uses: julia-actions/restic-action@main 29 | env: # Options: https://restic.readthedocs.io/en/latest/040_backup.html#environment-variables 30 | RESTIC_REPOSITORY: b2:${{ secrets.B2_BUCKET }}:${{ github.repository }} 31 | RESTIC_PASSWORD: ${{ secrets.RESTIC_PASSWORD }} 32 | B2_ACCOUNT_ID: ${{ secrets.B2_ACCOUNT_ID }} 33 | B2_ACCOUNT_KEY: ${{ secrets.B2_ACCOUNT_KEY }} 34 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2019-2020 GitHub, Inc., David Anthoff and contributors 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # julia-docdeploy 2 | 3 | ## Usage 4 | ```yaml 5 | name: Documenter 6 | on: 7 | push: 8 | branches: [main, master] 9 | tags: [v*] 10 | pull_request: 11 | 12 | jobs: 13 | Documenter: 14 | permissions: 15 | contents: write 16 | statuses: write 17 | name: Documentation 18 | runs-on: ubuntu-latest 19 | steps: 20 | - uses: actions/checkout@v4 21 | - uses: julia-actions/setup-julia@v2 22 | with: 23 | version: '1' # replace this with whatever version you need 24 | show-versioninfo: true # this causes versioninfo to be printed to the action log 25 | - uses: julia-actions/cache@v2 # cache using https://github.com/julia-actions/cache 26 | - uses: julia-actions/julia-buildpkg@v1 # if package requires Pkg.build() 27 | - uses: julia-actions/julia-docdeploy@v1 28 | env: 29 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 30 | ``` 31 | 32 | ### Prefixing the Julia command 33 | 34 | In some packages, you may want to prefix the `julia` command with another command, e.g. for running tests of certain graphical libraries with `xvfb-run`. 35 | In that case, you can add an input called `prefix` containing the command that will be inserted to your workflow: 36 | 37 | ```yaml 38 | - uses: julia-actions/julia-docdeploy@v1 39 | with: 40 | prefix: xvfb-run 41 | ``` 42 | 43 | ### Customizing installation of package into docs environment 44 | 45 | In some packages, you may want to install the package yourself into the docs environment. For example, if the package is in a subdirectory (but the docs environment is still top-level). In this case, you can pass `install-package: false`. 46 | 47 | ```yaml 48 | - uses: julia-actions/julia-docdeploy@v1 49 | with: 50 | install-package: false 51 | ``` 52 | 53 | ### Setting terminal width 54 | 55 | For some doctests, the default terminal width of GitHub Runners is too narrow. 56 | To change this, set the `COLUMNS` environment variable. 57 | 58 | ```yaml 59 | - uses: julia-actions/julia-docdeploy@v1 60 | env: 61 | COLUMNS: '200' 62 | ``` 63 | -------------------------------------------------------------------------------- /action.yml: -------------------------------------------------------------------------------- 1 | name: 'Deploy package documentation' 2 | description: 'Build and deploy the documentation for a Julia package.' 3 | author: 'David Anthoff' 4 | 5 | branding: 6 | icon: 'upload' 7 | color: 'gray-dark' 8 | 9 | inputs: 10 | prefix: 11 | description: 'Value inserted in front of the julia command, e.g. for running xvfb-run julia [...]' 12 | default: '' 13 | required: false 14 | install-package: 15 | description: 'Whether or not to install the package with `Pkg.develop` into the `docs` environment' 16 | default: true 17 | required: false 18 | project: 19 | description: 'Directory that contains the folder `docs` to deploy from' 20 | default: '.' 21 | required: false 22 | 23 | runs: 24 | using: 'composite' 25 | steps: 26 | - name: Install GitHubActions.jl in its own (shared) environment 27 | run: | 28 | using Pkg 29 | Pkg.activate("docs-logger-env"; shared=true) 30 | Pkg.add(Pkg.PackageSpec(name="GitHubActions", version="0.1")) 31 | shell: julia --color=yes {0} 32 | working-directory: ${{inputs.project}} 33 | - name: Install the current package into the `docs` environment 34 | run: | 35 | # The Julia command that will be executed 36 | julia_cmd=( julia --color=yes --code-coverage --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd()))' ) 37 | 38 | # Add the prefix in front of the command if there is one 39 | prefix=( ${{ inputs.prefix }} ) 40 | [[ ${#prefix[@]} -gt 0 ]] && julia_cmd=( "${prefix[@]}" "${julia_cmd[@]}" ) 41 | 42 | # Run the Julia command 43 | "${julia_cmd[@]}" 44 | shell: bash 45 | working-directory: ${{inputs.project}} 46 | if: ${{ inputs.install-package == 'true'}} 47 | - name: Instantiate the `docs` environment 48 | run: | 49 | # The Julia command that will be executed 50 | julia_cmd=( julia --color=yes --code-coverage --project=docs/ -e 'using Pkg; Pkg.instantiate()' ) 51 | 52 | # Add the prefix in front of the command if there is one 53 | prefix=( ${{ inputs.prefix }} ) 54 | [[ ${#prefix[@]} -gt 0 ]] && julia_cmd=( "${prefix[@]}" "${julia_cmd[@]}" ) 55 | 56 | # Run the Julia command 57 | "${julia_cmd[@]}" 58 | shell: bash 59 | working-directory: ${{inputs.project}} 60 | - name: Build the documentation 61 | run: | 62 | # The Julia command that will be executed 63 | julia_cmd=( julia --color=yes --project=docs/ -e ' 64 | @eval Module() begin 65 | push!(LOAD_PATH, "@docs-logger-env") # access GitHubActions.jl 66 | import Logging, GitHubActions 67 | Logging.global_logger(GitHubActions.GitHubActionsLogger()) 68 | pop!(LOAD_PATH) 69 | end 70 | include("docs/make.jl")' ) 71 | 72 | # Add the prefix in front of the command if there is one 73 | prefix="${{ inputs.prefix }}" 74 | [[ -n $prefix ]] && julia_cmd=( "$prefix" "${julia_cmd[@]}" ) 75 | 76 | # Run the Julia command 77 | "${julia_cmd[@]}" 78 | shell: bash 79 | working-directory: ${{inputs.project}} 80 | --------------------------------------------------------------------------------