Skip to content

Commit 798704e

Browse files
authored
Add GitHub Actions workflow for publishing metadata
This workflow publishes repository metadata periodically, triggered by a schedule and pushes to the main branch.
1 parent 4cf5474 commit 798704e

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

.github/workflows/releases.yaml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# This workflow publishes repository metadata periodically
2+
3+
on:
4+
schedule:
5+
- cron: '11 * * * *'
6+
push:
7+
branches:
8+
- main
9+
10+
permissions:
11+
contents: write
12+
13+
jobs:
14+
publish-metadata:
15+
name: Publish Metadata
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
22+
- name: Generate Metadata
23+
run: |
24+
mkdir -p release-files
25+
cat > release-files/metadata.json << EOF
26+
{
27+
"repository": "${{ github.repository }}",
28+
"commit_sha": "${{ github.sha }}",
29+
"ref": "${{ github.ref }}",
30+
"timestamp": "$(date -u +%Y-%m-%dT%H:%M:%SZ)",
31+
"workflow_run_id": "${{ github.run_id }}",
32+
"workflow_run_number": "${{ github.run_number }}",
33+
"event_name": "${{ github.event_name }}"
34+
}
35+
EOF
36+
cat release-files/metadata.json
37+
38+
- name: Create Release
39+
env:
40+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41+
run: |
42+
wget -qO- https://github.com/c4milo/github-release/releases/download/v1.1.0/github-release_v1.1.0_linux_amd64.tar.gz | tar zxvf -
43+
sudo mv github-release /usr/local/bin/github-release
44+
chmod +x /usr/local/bin/github-release
45+
VERSION=$(date +%Y%m%d.%H%M)
46+
github-release ${{ github.repository }} $VERSION ${{ github.ref_name }} "Metadata snapshot for $(date -u +%Y-%m-%d)" "release-files/metadata.json"

0 commit comments

Comments
 (0)