Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 69 additions & 6 deletions .github/workflows/periodic-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,97 @@ name: Periodic updates

on:
push:
branches: [ main ]
branches: [ master ]
paths: [ files.list ]
schedule:
- cron: "0 0 * * *"
workflow_dispatch: ~

jobs:
update:
runs-on: ubuntu-latest

outputs:
updated: ${{ steps.deploy-file.outputs.deployment-status }}
sha: ${{ steps.get-sha.outputs.sha }}
steps:
- name: Get current time
uses: srfrnk/current-time@master
id: current-time
with:
format: "YYYY-MM-DD HH:mm"

- name: Checkout
uses: actions/checkout@v3

uses: actions/checkout@v4
- name: Update
run: |
bash update-files.sh

- name: Push
uses: JamesIves/github-pages-deploy-action@v4
id: deploy-file
with:
branch: master
folder: .
git-config-name: github-actions[bot]
git-config-email: 41898282+github-actions[bot]@users.noreply.github.com
commit-message: updated ${{ steps.current-time.outputs.formattedTime }} UTC
- name: tagging-get-current-time
if: ${{ steps.deploy-file.outputs.deployment-status == 'success' }}
uses: srfrnk/current-time@master
id: current-time-tagging
with:
format: "YYYYMMDD"

- name: tagging
if: ${{ steps.deploy-file.outputs.deployment-status == 'success' }}
uses: anothrNick/[email protected]
env:
CUSTOM_TAG: ${{ steps.current-time-tagging.outputs.formattedTime }}
DEFAULT_BRANCH: master
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}


push_tag:
runs-on: ubuntu-latest
needs: [ update ]
# 仅在有 Push 时
if: ${{ needs.update.outputs.updated == 'success' }}
strategy:
matrix:
item: ['iana-etc', 'bind'] # TODO: 修改为 based by files.list
steps:
- name: Sleep to wait for GitHub process output
run: |
sleep 10s
- name: checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: refs/heads/master

- name: tagging-get-current-time
uses: srfrnk/current-time@master
id: current-time-tagging
with:
format: "YYYYMMDD"
- name: Get current time
uses: srfrnk/current-time@master
id: current-time
with:
format: "YYYY-MM-DD HH:mm"
- name: Push
uses: JamesIves/github-pages-deploy-action@v4
id: deploy-file
with:
branch: ${{ matrix.item }}
folder: ${{ matrix.item }}
git-config-name: github-actions[bot]
git-config-email: 41898282+github-actions[bot]@users.noreply.github.com
commit-message: "chore(ci): updated ${{ matrix.item }} ${{ steps.current-time.outputs.formattedTime }} UTC"

- name: Tagging
if: ${{ steps.deploy-file.outputs.deployment-status == 'success' }}
uses: anothrNick/[email protected]
env:
CUSTOM_TAG: ${{ matrix.item }}-${{ steps.current-time-tagging.outputs.formattedTime }}
DEFAULT_BRANCH: ${{ matrix.item }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

18 changes: 18 additions & 0 deletions .github/workflows/verify-update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Verify updates (check only)

on:
pull_request:
paths: [ files.list ]
workflow_dispatch: ~

jobs:
update:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Update
run: |
bash update-files.sh
50 changes: 49 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,52 @@
# misc-files
Repository for miscellaneous files frequently overwritten by upstreams

[![Periodic updates](https://github.com/AOSC-Dev/misc-files/actions/workflows/periodic-update.yml/badge.svg)](https://github.com/AOSC-Dev/misc-files/actions/workflows/periodic-update.yml)

Repository for miscellaneous files frequently overwritten by upstreams.

This repository is driven by the tracking list file `files.list` and utilizes GitHub Actions to keep files updated. Files in this repository are being used by the following packages:

- `iana-etc`:
- `/usr/share/iana-etc/port-numbers.iana`
- `/usr/share/iana-etc/protocol-numbers.iana`
- `bind` (Not currently referenced by autobuild scripts)

## `files.list`

This file tells what file should be tracked by which package and renamed in the following format:

```
package-name url [file-name]
```

Example:

```
bind https://www.internic.net/zones/named.root
```

* package-name: The name of the package to which the file belongs
* url: The URL to download the file from
* file-name: Optional, will default to `$(basename $url)` if not provided

## How the workflow works?

The main workflow `periodic-update` is triggered under the following conditions:

- Update `files.list` on branch `master`
- Cron `"0 0 * * *"`
- Manually triggered by maintainers

When triggered, the workflow:

1. Parses `files.list` to determine which files to download.
2. Downloads each file, optionally renames each file, and calculates its checksums.
3. If changes are detected:
- Commits the updates directly to the `master` branch
- Then syncs the updated files to their package-specific branch (e.g. `iana-etc`)
- Tags the commit in that branch with the current date (e.g. `iana-etc-20250914`)
4. If no changes are detected, the commit step is skipped and the workflow exits without further action.

## License

The workflow itself is licensed under the MIT License. All other files originated from external sources are subject to their respective upstream license.
9 changes: 6 additions & 3 deletions files.list
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
https://www.internic.net/zones/named.root
# package-name url [file-name]
# bind https://www.internic.net/zones/named.root
# iana-etc https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xml service-names-port-numbers.iana
bind https://www.internic.net/zones/named.root

https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xml
https://www.iana.org/assignments/protocol-numbers/protocol-numbers.xml
iana-etc https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xml
iana-etc https://www.iana.org/assignments/protocol-numbers/protocol-numbers.xml
92 changes: 0 additions & 92 deletions named.root

This file was deleted.

1 change: 0 additions & 1 deletion named.root.sha256sum

This file was deleted.

Loading