|
1 | | -# You have to set PAT and add secrete ACCESS_OKREGISTRY in the repo {{{PKG}}} |
2 | | -# see also the default template: https://github.com/JuliaCI/PkgTemplates.jl/blob/master/templates/github/workflows/register.yml |
3 | | -# Also see [Running GitHub Actions Sequentially](https://stevenmortimer.com/running-github-actions-sequentially/) to separate updateokreg out from CI.yml, and trigger TagBot sequentially. |
4 | | -# CHECKPOINT: Currently substitution (e.g., {{{PKG}}}) failed. |
5 | | - |
6 | | -name: Register Package to OkRegistry |
| 1 | +name: Register Package |
7 | 2 | on: |
8 | | - push: |
9 | | - paths: |
10 | | - - "Project.toml" |
11 | | - issue_comment: |
12 | | - types: |
13 | | - - created |
14 | 3 | workflow_dispatch: |
15 | | - |
16 | | -env: |
17 | | - # It seems to be redundant to define them first. |
18 | | - CHANGELOG_MESSAGE: "CHANGELOG_MESSAGE not available" |
19 | | - JULIA_VERSION: " " |
20 | | - |
21 | | -permissions: |
22 | | - actions: read |
23 | | - checks: read |
24 | | - contents: write |
25 | | - deployments: read |
26 | | - issues: read |
27 | | - discussions: read |
28 | | - packages: read |
29 | | - pages: read |
30 | | - pull-requests: read |
31 | | - repository-projects: read |
32 | | - security-events: read |
33 | | - statuses: read |
34 | | -# `contents: write` is required to allow `peter-evans/repository-dispatch`. You may alternatively on your github go to [settings-actions](https://github.com/okatsn/{{{PKG}}}.jl/settings/actions) to set the default permissions granted to the `GITHUB_TOKEN` to Read and write. |
| 4 | + inputs: |
| 5 | + version: |
| 6 | + description: Version to register or component to bump |
| 7 | + required: true |
35 | 8 | jobs: |
36 | | - UpdateOkReg: |
37 | | - # if: github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot' |
38 | | - runs-on: ubuntu-24.04 |
| 9 | + register: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + permissions: |
| 12 | + contents: write |
39 | 13 | steps: |
40 | | - - uses: julia-actions/setup-julia@v2 |
| 14 | + - uses: julia-actions/RegisterAction@latest |
41 | 15 | with: |
42 | | - version: 1.10.10 |
43 | | - - uses: okatsn/add-registry@v2 |
44 | | - - uses: actions/checkout@v5 # see https://github.com/actions/checkout |
45 | | - with: |
46 | | - path: TEMP |
47 | | - - uses: actions/checkout@v5 # see https://github.com/actions/checkout |
48 | | - with: |
49 | | - repository: okatsn/OkRegistry |
50 | | - path: OkRegistry |
51 | | - token: ${{ secrets.ACCESS_OKREGISTRY }} |
52 | | - # Update OkRegistry first. |
53 | | - # 1. Current path is critical. Please refer to "add_local_pkg_to_registry.jl" in OkRegistry. |
54 | | - # 2. `git config` is required, and has to be done in repo OkRegistry (cd OkRegistry must precede) |
55 | | - # 3. Personal registry is add per julia install; that is, OkRegistry should be added before `Pkg.instantiate()` |
56 | | - # 4. The empty General registry issue is solved after okatsn/add-registry@v2.0.1; the following code runs only when okatsn/add-registry@v2.0.1 (or later) is applied |
57 | | - - run: | |
58 | | - cd OkRegistry |
59 | | - git config --local user.email "action@github.com" |
60 | | - git config --local user.name "github-actions" |
61 | | - julia --project=@. -e ' |
62 | | - using Pkg; |
63 | | - Pkg.instantiate(); |
64 | | - using OkRegistrator; |
65 | | - okciregister() |
66 | | - ' |
67 | | - cd .. |
68 | | - - uses: okatsn/get-changelog@v1 |
69 | | - with: |
70 | | - dir0: TEMP |
71 | | - id: regist |
72 | | - # KEYNOTE: |
73 | | - # - Declare dynamic variables (not used in this script) https://dev.to/a1ex/tricks-of-declaring-dynamic-variables-in-bash-15b9 |
74 | | - # - How to override an environment variable in Github Actions? https://stackoverflow.com/questions/66687561/how-to-override-an-environment-variable-in-github-actions |
75 | | - |
76 | | - - name: Trigger next workflow # You may alternatively use https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idneeds |
77 | | - if: success() # https://docs.github.com/en/actions/learn-github-actions/expressions#success |
78 | | - # && github.event_name == 'push' # KEYNOTE: must have this condition if `github.event.commits` is used in the followings. `github.event.commits` is only available in [push webhook payload](https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#push). |
79 | | - # if: success() # Use this condition instead if `github.event.commits` is not applied herein after AND you want trigger-tagbot dispatch workflows `on` events other that `push`. |
80 | | - env: |
81 | | - CHANGELOG_MESSAGE: ${{ steps.regist.outputs.content }} |
82 | | - JULIA_VERSION: ${{ steps.regist.outputs.version }} |
83 | | - uses: peter-evans/repository-dispatch@v4 # See https://github.com/peter-evans/repository-dispatch |
84 | | - with: |
85 | | - repository: ${{ github.repository }} |
86 | | - event-type: trigger-tagbot |
87 | | - token: ${{ secrets.GITHUB_TOKEN }} # default is GITHUB_TOKEN |
88 | | - client-payload: '{"logfile_msg": "${{ env.CHANGELOG_MESSAGE }}", "version": "${{ env.JULIA_VERSION }}" }' |
89 | | - # Delete this client-payload line and `client_payload` lines in `TagBot.yml` if you don't want commit message appears. |
90 | | - # Push everything else before you push `Project.toml` with version number raised and commit it solely with commit message that will also appear as part of the release notes. |
91 | | - # Also see OkPkgTemplates.PLUGIN_REGISTER() for explanation. |
92 | | - # Noted that multiline string (for commit message) is not acceptable for json. See PLUGIN_REGISTER for more info. |
| 16 | + token: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments